small fix to key pressed function