                 })
         }
         
-        return promise
+        return deferred.promise
     }
 }
 

        }
    }

    private func append<U>(dispatchQueue: dispatch_queue_t, nextPromise: Promise<U>, onRejected: (NSError -> Void)?) {
        let onRejectedAsync = { (error: NSError) -> Void in
            dispatch_async(dispatchQueue, {
                onRejected?(error)
                nextPromise.reject(error)
            })
        }


                            values.append(value)

                            if values.count == promises.count {
                                deferred.fulfill(values)
                                pending = false
                                values.removeAll(keepCapacity: false)
                            }
