support es6 promise api.Fixes #560