enhance add event function