Fix error checking in obj.on for eventingLibrary.js