     func writeBlock(block: Block) {
         
         let data = FastCoder.dataWithRootObject(block)
-        write(data)
+        if data != nil {
+            write(data!)
+        } else {
+            assertionFailure("NSData is nil")
+        }
+        
     }
     
     func deleteBlock(aID: UID) -> CUnsignedLongLong {

            //var header = readHeader()
            
            let data = readBlock()
            let block = FastCoder.objectWithData(data) as! Block
            
            let index = calculateID(pos)
            
            if block.used {
                 analyseUsedBlock(block, forUID: index)
            } else {
                // add pos into the special dictionary
                self.unusedDataSegments[pos] = true
            }
            
            /**

        let data = readBlock()
        
        if data.length > 0 {
            let block = FastCoder.objectWithData(data) as! Block?
            if block != nil {
               return block!.obj as? O
            }
