Fixed an issue around the handling of the promise