fix weird javascript bug on updating events'