fixed bug in es6 promise implementation