Added checks for event handler processing.