Fix bug where wrong event was removed