fixed up when.js