diff --git a/src/uifc/filepick.c b/src/uifc/filepick.c
index 54e105780ed993da449e3dfd3629c6c061f82d9f..ba52ce7335290adebcb512f2ca842e915f66ab90 100644
--- a/src/uifc/filepick.c
+++ b/src/uifc/filepick.c
@@ -297,8 +297,8 @@ int filepick(uifcapi_t *api, char *title, struct file_pick *fp, char *dir, char
 	int		listwidth;
 	char	**dir_list=NULL;
 	char	**file_list=NULL;
-	int		currfield=DIR_LIST;
-	int		lastfield=DIR_LIST;
+	int		currfield;
+	int		lastfield;
 	int		i;
 	int		root=0;						/* Is this the root of the file system? */
 										/* On *nix, this just means no .. on Win32,
@@ -331,6 +331,11 @@ int filepick(uifcapi_t *api, char *title, struct file_pick *fp, char *dir, char
 	if((opts & UIFC_FP_MULTI)==UIFC_FP_MULTI && (opts & (UIFC_FP_ALLOWENTRY|UIFC_FP_OVERPROMPT|UIFC_FP_CREATPROMPT)))
 		return(-1);
 
+	if (opts & UIFC_FP_DIRSEL)
+		currfield = lastfield = DIR_LIST;
+	else
+		currfield = lastfield = FILE_LIST;
+
 	fp->files=0;
 	fp->selected=NULL;