Added extra 'handler' parameter check to 'function' to on() event handler setter.