fixes keypress behaviour