Fix crash on adding events.