Bugfix in Promise implementation