Fix a bug where the wrong element woudl get the click event