fix issue with event handling