working on Deferred.when