Fix a bug that would cause a click event to be fired twice in some situations