Fixed broken events.js code