Fix crash when pressed keyboard