diff --git a/src/files.c b/src/files.c
index 566b9c8caff7dbaeb078b6c15258a7ccf4e32b85..dbd6e654d765c508d74149c8f6c51b48acf92198 100644
--- a/src/files.c
+++ b/src/files.c
@@ -1563,15 +1563,9 @@ void init_operating_dir(void)
 
     full_operating_dir = get_full_path(operating_dir);
 
-    /* If get_full_path() failed or the operating directory is
-     * inaccessible, unset operating_dir. */
-    if (full_operating_dir == NULL || chdir(full_operating_dir) == -1) {
-	statusline(ALERT, _("Not a valid directory: %s"), operating_dir);
-	free(full_operating_dir);
-	full_operating_dir = NULL;
-	free(operating_dir);
-	operating_dir = NULL;
-    }
+    /* If the operating directory is inaccessible, fail. */
+    if (full_operating_dir == NULL || chdir(full_operating_dir) == -1)
+	die("Invalid operating directory\n");
 }
 
 /* Check to see if we're inside the operating directory.  Return FALSE
diff --git a/src/nano.c b/src/nano.c
index 5c1b78a029a85706d50425a8df7c31bd743887ca..8bbe7415aedc1205a7b56dfd2f8a544f22014eab 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -2037,6 +2037,9 @@ int main(int argc, char **argv)
     };
 #endif
 
+    /* Back up the terminal settings so that they can be restored. */
+    tcgetattr(0, &oldterm);
+
 #ifdef ENABLE_UTF8
     {
 	/* If the locale set exists and uses UTF-8, we should use
@@ -2423,6 +2426,12 @@ int main(int argc, char **argv)
 	init_backup_dir();
 #endif
 
+#ifndef DISABLE_OPERATINGDIR
+    /* Set up the operating directory.  This entails chdir()ing there,
+     * so that file reads and writes will be based there. */
+    init_operating_dir();
+#endif
+
 #ifndef DISABLE_JUSTIFY
     /* If punct wasn't specified, set its default value. */
     if (punct == NULL)
@@ -2504,9 +2513,6 @@ int main(int argc, char **argv)
     if (tabsize == -1)
 	tabsize = WIDTH_OF_TAB;
 
-    /* Back up the old terminal settings so that they can be restored. */
-    tcgetattr(0, &oldterm);
-
     /* Initialize curses mode.  If this fails, get out. */
     if (initscr() == NULL)
 	exit(1);
@@ -2554,12 +2560,6 @@ int main(int argc, char **argv)
 	controlright = key_defined(keyvalue);
 #endif
 
-#ifndef DISABLE_OPERATINGDIR
-    /* Set up the operating directory.  This entails chdir()ing there,
-     * so that file reads and writes will be based there. */
-    init_operating_dir();
-#endif
-
 #ifdef DEBUG
     fprintf(stderr, "Main: open file\n");
 #endif