Made keymap parser more robust