pass the deferred object into the callback