diff --git a/modules/system/system.module b/modules/system/system.module
index fbe5761..ec65ad7 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -832,13 +832,15 @@ function system_theme_data() {
       // Record the name of each theme found in the file system.
       $names[] = $theme->name;
       // Update the contents of the system table.
-      if (isset($theme->status) && !(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE != 'install')) {
-        db_query("UPDATE {system} SET owner = '%s', info = '%s', filename = '%s' WHERE name = '%s' AND type = '%s'", $theme->owner, serialize($theme->info), $theme->filename, $theme->name, 'theme');
-      }
-      else {
-        $theme->status = ($theme->name == variable_get('theme_default', 'garland'));
-        // This is a new theme.
-        db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, $theme->status, 0, 0);
+      if (!(defined('MAINTENANCE_MODE') && MAINTENANCE_MODE != 'install')) {
+        if (isset($theme->status)) {
+          db_query("UPDATE {system} SET owner = '%s', info = '%s', filename = '%s' WHERE name = '%s' AND type = '%s'", $theme->owner, serialize($theme->info), $theme->filename, $theme->name, 'theme');
+        }
+        else {
+          $theme->status = ($theme->name == variable_get('theme_default', 'garland'));
+          // This is a new theme.
+          db_query("INSERT INTO {system} (name, owner, info, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', '%s', %d, %d, %d)", $theme->name, $theme->owner, serialize($theme->info), 'theme', $theme->filename, $theme->status, 0, 0);
+        }
       }
     }
     // Delete from the system table any themes missing from the file system.
