     
     public func flatMap<D>(f: (T) -> Future<D>) -> Future<D> {
         let mappedFuture = Future<D>(operationQueue: self.operationQueue, callbackQueue: self.callbackQueue)
-        self.mappedCompletionF = {
-            if self.futureValue!.value != nil {
-                f(self.futureValue!.value!)
+        self.mappedCompletionF = {futureValue in
+            if futureValue.value != nil {
+                f(futureValue.value!)
                 .onSuccess { x in
                     mappedFuture.completeWith(x)
                     return Void()

    private var f: (() -> Try<T>)? = nil
    private var futureValue: Try<T>?
    private var completionF: ((Try<T>) -> ())?
    private var mappedCompletionF:(() -> ())?
    
    private var bindCheck: BindCheck = BindCheck.BoolCheck({ true })
    

                }
            }
            else {
                mappedFuture.completeWith(futureValue.error!)
            }
            
        }
