fixing event listener issue