Fix bug with events