Fix bugs with createEvent