events.js fixes