fixed event handler bug