replaced goog.async.Deferred with when lib
fixed bugs of when lib integration