Keyboard handling fix