Fix possible bug of events