Move the cancel event to the bottom of the function. Possible fix to calendar event problem