fixing keydown and keyup bug