correctly return deferred promise