move from when.js to promise.js