Support returned promises
Fix deferrered promises a bit