Fixed event handling error