Keyboard handling fix and other minor fixes.