diff --git template.php template.php
index a7e53e5..19b6aab 100644
--- template.php
+++ template.php
@@ -402,6 +402,7 @@ function zen_preprocess_maintenance_page(&$vars, $hook) {
 
   // Classes for body element. Allows advanced theming based on context
   // (home page, node of certain type, etc.)
+  if (!isset($vars['body_classes'])) $vars['body_classes'] = '';
   $vars['body_classes_array'] = explode(' ', $vars['body_classes']);
 }
 
diff --git zen-internals/template.conditional-styles.inc zen-internals/template.conditional-styles.inc
index 8211d1a..d8c0507 100644
--- zen-internals/template.conditional-styles.inc
+++ zen-internals/template.conditional-styles.inc
@@ -38,6 +38,9 @@ function conditional_styles_paths_to_basetheme($theme) {
  * When the theme registry is rebuilt, we also build the conditional stylesheets.
  */
 function _conditional_styles_theme($existing, $type, $theme, $path) {
+  // If there is not a workind database, this function has no purpose.
+  if (!db_is_active())  return array();
+
   // @TODO: For PHP 4 compatibility we use foreach (array_keys($array) AS $key).
   // When PHP 5 becomes required (Drupal 7.x), use the following faster
   // implementation: foreach ($array AS $key => &$value) {}
diff --git zen-internals/template.theme-registry.inc zen-internals/template.theme-registry.inc
index 836cb71..95baea6 100644
--- zen-internals/template.theme-registry.inc
+++ zen-internals/template.theme-registry.inc
@@ -111,7 +111,9 @@ function zen_theme_get_default_settings($theme) {
     // Merge the defaults with the theme settings saved in the database.
     $settings = array_merge($defaults, variable_get('theme_'. $theme .'_settings', array()));
     // Save the settings back to the database.
-    variable_set('theme_'. $theme .'_settings', $settings);
+    if (db_is_active()) {
+      variable_set('theme_'. $theme .'_settings', $settings);
+    }
     // If the active theme has been loaded, force refresh of Drupal internals.
     if (!empty($GLOBALS['theme_key'])) {
       theme_get_setting('', TRUE);
