bug fix for event handler