minor events.js improvments