Problems with event listener fixed