Added safeguard for event cancelling