Fix issue with event handling