Fix event handling