actually register the event handler