improve keymap parsing