Fixed a bug when resolving a promise with a promise