modify the event function