Index: system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.247
diff -u -r1.247 system.module
--- system.module	26 Oct 2005 01:24:09 -0000	1.247
+++ system.module	30 Oct 2005 23:43:51 -0000
@@ -161,27 +161,30 @@
     $themes = list_themes();
     ksort($themes);
 
-    // Reset to follow site default theme if user selects the site default
-    if ($key == variable_get('theme_default', 'bluemarine')) {
-      $key = '';
-      if ($edit['theme'] == variable_get('theme_default', 'bluemarine')) {
-        $edit['theme'] = '';
-      }
-    }
-
     $form['themes'] = array(
       '#type' => 'fieldset', '#title' => t('Theme configuration'), '#description' => t('Selecting a different theme will change the look and feel of the site.'), '#weight' => 2, '#collapsible' => TRUE, '#collapsed' => FALSE, '#theme' => 'system_user');
 
     foreach ($themes as $info) {
+      // Reset to follow site default theme if user selects the site default
+      if ($info->name == variable_get('theme_default', 'bluemarine')) {
+        $key = '';
+        if ($edit['theme'] == variable_get('theme_default', 'bluemarine')) {
+          $edit['theme'] = '';
+        }
+      }
+      else {
+        $key = $info->name;
+      }
+
       $info->screenshot = dirname($info->filename) . '/screenshot.png';
       $screenshot = file_exists($info->screenshot) ? theme('image', $info->screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), false) : t('no screenshot');
 
-      $form['themes'][$info->name]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
-      $form['themes'][$info->name]['description'] = array('#type' => 'item', '#title' => $info->name,  '#value' => dirname($info->filename));
-      $options[$info->name] = '';
+      $form['themes'][$key]['screenshot'] = array('#type' => 'markup', '#value' => $screenshot);
+      $form['themes'][$key]['description'] = array('#type' => 'item', '#title' => $info->name,  '#value' => dirname($info->filename));
+      $options[$key] = $info->name;
     }
 
-    $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : variable_get('theme_default', 'bluemarine'));
+    $form['themes']['theme'] = array('#type' => 'radios', '#options' => $options, '#default_value' => $edit['theme'] ? $edit['theme'] : '');
 
     if (variable_get('configurable_timezones', 1)) {
       $zones = _system_zonelist();
