Fixed issue where deferred was undefined