Prevents rogue event handlers from being called

Fix #614