fix keyboard handling