correcting the event handlers