Correct errors in promise resolution