fix event handling