Fixed deadlock in keyboard.cc