Fix for when() resolving incorrectly with promises

This prevents resolved promises passed to when() from being positioned
incorrectly in the
callback's arguments.