Update events.md

making code example make sense and match the comment associated with it