Fix click event handler bug