fix slowness and key input problem