diff --git a/src/matcher.c b/src/matcher.c
index fd1b25a..1da4093 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -34,6 +34,7 @@ struct _vte_matcher {
 
 static GStaticMutex _vte_matcher_mutex = G_STATIC_MUTEX_INIT;
 static GCache *_vte_matcher_cache = NULL;
+
 static struct _vte_matcher_impl dummy_vte_matcher_trie = {
 	&_vte_matcher_trie
 };
@@ -67,33 +68,36 @@ #ifdef VTE_DEBUG
 	}
 #endif
 
-	/* Load the known capability strings from the termcap structure into
-	 * the table for recognition. */
-	for (i = 0;
-	     _vte_terminal_capability_strings[i].capability[0];
-	     i++) {
-		if (_vte_terminal_capability_strings[i].key) {
-			continue;
-		}
-		code = _vte_terminal_capability_strings[i].capability;
-		stripped = _vte_termcap_find_string_length(termcap,
-                                                           emulation,
-                                                           code,
-                                                           &stripped_length);
-		if (stripped[0] != '\0') {
-			_vte_matcher_add(matcher, stripped, stripped_length,
-					 code, 0);
-			if (stripped[0] == '\r') {
-				found_cr = TRUE;
-			} else
-			if (stripped[0] == '\n') {
-				if ((strcmp(code, "sf") == 0) ||
-				    (strcmp(code, "do") == 0)) {
-					found_lf = TRUE;
+	if (termcap != NULL) {
+		/* Load the known capability strings from the termcap
+		 * structure into the table for recognition. */
+		for (i = 0;
+		     _vte_terminal_capability_strings[i].capability[0];
+		     i++) {
+			if (_vte_terminal_capability_strings[i].key) {
+				continue;
+			}
+			code = _vte_terminal_capability_strings[i].capability;
+			stripped = _vte_termcap_find_string_length(termcap,
+								   emulation,
+								   code,
+								   &stripped_length);
+			if (stripped[0] != '\0') {
+				_vte_matcher_add(matcher,
+					       	 stripped, stripped_length,
+						 code, 0);
+				if (stripped[0] == '\r') {
+					found_cr = TRUE;
+				} else
+				if (stripped[0] == '\n') {
+					if ((strcmp(code, "sf") == 0) ||
+					    (strcmp(code, "do") == 0)) {
+						found_lf = TRUE;
+					}
 				}
 			}
+			g_free(stripped);
 		}
-		g_free(stripped);
 	}
 
 	/* Add emulator-specific sequences. */
diff --git a/src/vte.c b/src/vte.c
index 26486bd..9b7fe6c 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -876,14 +876,17 @@ _vte_terminal_set_tabstop(VteTerminal *t
 static void
 vte_terminal_set_default_tabstops(VteTerminal *terminal)
 {
-	int i, width;
+	int i, width = 0;
 	if (terminal->pvt->tabstops != NULL) {
 		g_hash_table_destroy(terminal->pvt->tabstops);
 	}
 	terminal->pvt->tabstops = g_hash_table_new(NULL, NULL);
-	width = _vte_termcap_find_numeric(terminal->pvt->termcap,
-					  terminal->pvt->emulation,
-					  "it");
+
+	if (terminal->pvt->termcap != NULL) {
+		width = _vte_termcap_find_numeric(terminal->pvt->termcap,
+						  terminal->pvt->emulation,
+						  "it");
+	}
 	if (width == 0) {
 		width = VTE_TAB_WIDTH;
 	}
@@ -4111,7 +4114,7 @@ #endif
 		}
 		/* If the above switch statement didn't do the job, try mapping
 		 * it to a literal or capability name. */
-		if (handled == FALSE) {
+		if (handled == FALSE && terminal->pvt->termcap != NULL) {
 			_vte_keymap_map(keyval, terminal->pvt->modifiers,
 					terminal->pvt->sun_fkey_mode,
 					terminal->pvt->hp_fkey_mode,
@@ -4134,7 +4137,7 @@ #endif
 		}
 		/* If we didn't manage to do anything, try to salvage a
 		 * printable string. */
-		if (!handled && (normal == NULL) && (special == NULL)) {
+		if (handled == FALSE && normal == NULL && special == NULL) {
 			/* Convert the keyval to a gunichar. */
 			keychar = gdk_keyval_to_unicode(keyval);
 			normal_length = 0;
@@ -4188,7 +4191,7 @@ #endif
 			g_free(normal);
 		} else
 		/* If the key maps to characters, send them to the child. */
-		if (special != NULL) {
+		if (special != NULL && terminal->pvt->termcap != NULL) {
 			termcap = terminal->pvt->termcap;
 			tterm = terminal->pvt->emulation;
 			normal = _vte_termcap_find_string_length(termcap,
@@ -6520,31 +6523,33 @@ #endif
 	terminal->pvt->matcher = _vte_matcher_new(emulation, terminal->pvt->termcap);
 
 	/* Read emulation flags. */
-	terminal->pvt->flags.am = _vte_termcap_find_boolean(terminal->pvt->termcap,
-							    terminal->pvt->emulation,
-							    "am");
-	terminal->pvt->flags.bw = _vte_termcap_find_boolean(terminal->pvt->termcap,
-							    terminal->pvt->emulation,
-							    "bw");
-	terminal->pvt->flags.LP = _vte_termcap_find_boolean(terminal->pvt->termcap,
-							    terminal->pvt->emulation,
-							    "LP");
-	terminal->pvt->flags.ul = _vte_termcap_find_boolean(terminal->pvt->termcap,
-							    terminal->pvt->emulation,
-							    "ul");
-	terminal->pvt->flags.xn = _vte_termcap_find_boolean(terminal->pvt->termcap,
-							    terminal->pvt->emulation,
-							    "xn");
-
-	/* Resize to the given default. */
-	columns = _vte_termcap_find_numeric(terminal->pvt->termcap,
-					    terminal->pvt->emulation,
-					    "co");
-	rows = _vte_termcap_find_numeric(terminal->pvt->termcap,
-					 terminal->pvt->emulation,
-					 "li");
-	terminal->pvt->default_column_count = columns;
-	terminal->pvt->default_row_count = rows;
+	if (terminal->pvt->termcap != NULL) {
+		terminal->pvt->flags.am = _vte_termcap_find_boolean(terminal->pvt->termcap,
+								    terminal->pvt->emulation,
+								    "am");
+		terminal->pvt->flags.bw = _vte_termcap_find_boolean(terminal->pvt->termcap,
+								    terminal->pvt->emulation,
+								    "bw");
+		terminal->pvt->flags.LP = _vte_termcap_find_boolean(terminal->pvt->termcap,
+								    terminal->pvt->emulation,
+								    "LP");
+		terminal->pvt->flags.ul = _vte_termcap_find_boolean(terminal->pvt->termcap,
+								    terminal->pvt->emulation,
+								    "ul");
+		terminal->pvt->flags.xn = _vte_termcap_find_boolean(terminal->pvt->termcap,
+								    terminal->pvt->emulation,
+								    "xn");
+
+		/* Resize to the given default. */
+		columns = _vte_termcap_find_numeric(terminal->pvt->termcap,
+						    terminal->pvt->emulation,
+						    "co");
+		rows = _vte_termcap_find_numeric(terminal->pvt->termcap,
+						 terminal->pvt->emulation,
+						 "li");
+		terminal->pvt->default_column_count = columns;
+		terminal->pvt->default_row_count = rows;
+	}
 
 	/* Notify observers that we changed our emulation. */
 	vte_terminal_emit_emulation_changed(terminal);
@@ -6583,6 +6588,21 @@ vte_terminal_get_emulation(VteTerminal *
 	return terminal->pvt->emulation;
 }
 
+void _vte_terminal_inline_error_message(VteTerminal *terminal, const char *format, ...)
+{
+	va_list ap;
+	char *str;
+       
+	va_start(ap, format);
+	str = g_strdup_vprintf(format, ap);
+	va_end(ap);
+
+	vte_terminal_feed(terminal, "*** VTE ***: ", 13);
+	vte_terminal_feed(terminal, str, -1);
+	vte_terminal_feed(terminal, "\r\n", 2);
+	g_free(str);
+}
+
 /* Set the path to the termcap file we read, and read it in. */
 static void
 vte_terminal_set_termcap(VteTerminal *terminal, const char *path,
@@ -6613,10 +6633,15 @@ #ifdef VTE_DEBUG
 			terminal->pvt->termcap_path);
 	}
 #endif
-	if (terminal->pvt->termcap) {
+	if (terminal->pvt->termcap != NULL) {
 		_vte_termcap_free(terminal->pvt->termcap);
 	}
 	terminal->pvt->termcap = _vte_termcap_new(terminal->pvt->termcap_path);
+	if (terminal->pvt->termcap == NULL) {
+		_vte_terminal_inline_error_message(terminal,
+			       	"Failed to load terminal capabilities '%s'",
+				path);
+	}
 #ifdef VTE_DEBUG
 	if (_vte_debug_on(VTE_DEBUG_MISC)) {
 		g_printerr("\n");
@@ -6766,6 +6791,22 @@ #endif
 
 	/* We allocated zeroed memory, just fill in non-zero stuff. */
 
+	/* Set up I/O encodings. */
+	pvt->iso2022 = _vte_iso2022_state_new(pvt->encoding,
+					      _vte_terminal_codeset_changed_cb,
+					      terminal);
+	pvt->incoming = _vte_buffer_new();
+	pvt->pending = g_array_new(FALSE, FALSE, sizeof(gunichar));
+	pvt->cursor_blink_tag = VTE_INVALID_SOURCE;
+	pvt->process_timeout = VTE_INVALID_SOURCE;
+	pvt->update_timeout = VTE_INVALID_SOURCE;
+	pvt->outgoing = _vte_buffer_new();
+	pvt->outgoing_conv = VTE_INVALID_CONV;
+	pvt->conv_buffer = _vte_buffer_new();
+	vte_terminal_set_encoding(terminal, NULL);
+	g_assert(terminal->pvt->encoding != NULL);
+
+
 	/* Load the termcap data and set up the emulation. */
 	pvt->keypad_mode = VTE_KEYMODE_NORMAL;
 	pvt->cursor_mode = VTE_KEYMODE_NORMAL;
@@ -6785,21 +6826,6 @@ #endif
 	pvt->pty_output_source = VTE_INVALID_SOURCE;
 	pvt->pty_pid = -1;
 
-	/* Set up I/O encodings. */
-	pvt->iso2022 = _vte_iso2022_state_new(pvt->encoding,
-					      &_vte_terminal_codeset_changed_cb,
-					      terminal);
-	pvt->incoming = _vte_buffer_new();
-	pvt->pending = g_array_new(FALSE, FALSE, sizeof(gunichar));
-	pvt->cursor_blink_tag = VTE_INVALID_SOURCE;
-	pvt->process_timeout = VTE_INVALID_SOURCE;
-	pvt->update_timeout = VTE_INVALID_SOURCE;
-	pvt->outgoing = _vte_buffer_new();
-	pvt->outgoing_conv = VTE_INVALID_CONV;
-	pvt->conv_buffer = _vte_buffer_new();
-	vte_terminal_set_encoding(terminal, NULL);
-	g_assert(terminal->pvt->encoding != NULL);
-
 	/* Initialize the screens and histories. */
 	vte_terminal_reset_rowdata(&pvt->alternate_screen.row_data,
 				   pvt->scrollback_lines);
@@ -7319,7 +7345,9 @@ #endif
 	if (terminal->pvt->matcher != NULL) {
 		_vte_matcher_free(terminal->pvt->matcher);
 	}
-	_vte_termcap_free(terminal->pvt->termcap);
+	if (terminal->pvt->termcap != NULL) {
+		_vte_termcap_free(terminal->pvt->termcap);
+	}
 
 	remove_update_timeout (terminal);
 
