Event handler bug fixes