fixed js event handling to allow callback setting