event handler bug fix