Update to make sure promises are resolved with the proper context