Add optional safety checks for addEvent