Fix second addEvents function