fix an issue with Promise not rejecting