fix event handling problem