changed es6-promise to when.js