--- a/joe/kbd.c
+++ b/joe/kbd.c
@@ -232,9 +232,9 @@
 		s = jgetstr(cap, seq + 1);
 		seq[x] = c;
 		if (s && (s = tcompile(cap, s, 0, 0, 0, 0))
-		    && (sLEN(s) > 1 || (signed char)s[0] < 0)) {
+		    && (vslen(s) > 1 || (signed char)s[0] < 0)) {
 			capseq = s;
-			seql = sLEN(s);
+			seql = vslen(s);
 			for (seq += x; *seq == ' '; ++seq) ;
 		}
 #endif
@@ -343,30 +343,14 @@
 
 B *keymaphist=0;
 
-int dokeymap(BW *bw,unsigned char *s,void *object,int *notify)
-{
-	KMAP *k=ngetcontext(s);
-	vsrm(s);
-	if(notify) *notify=1;
-	if(!k) {
-		msgnw(bw->parent,joe_gettext(_("No such keymap")));
-		return -1;
-	}
-	rmkbd(bw->parent->kbd);
-	bw->parent->kbd=mkkbd(k);
-	return 0;
-}
-
 static unsigned char **keymap_list;
 
 static int keymap_cmplt(BW *bw)
 {
-	/* Reload every time: we should really check date of tags file...
-	  if (tag_word_list)
-	  	varm(tag_word_list); */
-
-	if (!keymap_list)
+	if (!keymap_list) {
 		keymap_list = get_keymap_list();
+		vaperm(keymap_list);
+	}
 
 	if (!keymap_list) {
 		ttputc(7);
@@ -378,6 +362,18 @@
 
 int ukeymap(BASE *bw)
 {
-	if (wmkpw(bw->parent,joe_gettext(_("Change keymap: ")),&keymaphist,dokeymap,USTR "keymap",NULL,keymap_cmplt,NULL,NULL,locale_map,0)) return 0;
-	else return -1;
-}
+	unsigned char *s = ask(bw->parent, joe_gettext(_("Change keymap: ")),
+	&keymaphist,USTR "keymap",keymap_cmplt,locale_map,0,0,NULL);
+	if (s) {
+		KMAP *k=ngetcontext(s);
+		if(!k) {
+			msgnw(bw->parent,joe_gettext(_("No such keymap")));
+			return -1;
+		}
+		rmkbd(bw->parent->kbd);
+		bw->parent->kbd=mkkbd(k);
+		return 0;
+	} else {
+		return -1;
+	}
+}