Fixed bug with promise resolve value