fix small when.js regression