corrected event handler