Fixed a crash in Keyboard controller