Corrected a variable assignment problem in updateEvents().