fixing the event listeners