Fix keyboard handling