completely fix incorrect event handling