Event handling mistakes corrected