fixing keypress event listener