Fix bug in events