replace Promise with When.js