bug fixed for addEvents