diff --git a/includes/common.inc b/includes/common.inc
index ad2a345..f87e26d 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -5155,6 +5155,8 @@ function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) {
 }
 
 function _drupal_bootstrap_full() {
+  //create global variable for theme init
+  global $drupal_theme_init;
   static $called = FALSE;
 
   if ($called) {
@@ -5203,6 +5205,7 @@ function _drupal_bootstrap_full() {
   // Let all modules take action before the menu system handles the request.
   // We do not want this while running update.php.
   if (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update') {
+    $drupal_theme_init = 0;
     // Prior to invoking hook_init(), initialize the theme (potentially a custom
     // one for this page), so that:
     // - Modules with hook_init() implementations that call theme() or
@@ -5211,6 +5214,7 @@ function _drupal_bootstrap_full() {
     //   (e.g., hook_form_alter(), hook_node_view_alter(), hook_page_alter()),
     //   ahead of when rendering starts.
     menu_set_custom_theme();
+    $drupal_theme_init=1;
     drupal_theme_initialize();
     module_invoke_all('init');
   }
diff --git a/includes/theme.inc b/includes/theme.inc
index ed34b82..3de8d0d 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -68,6 +68,10 @@ function _drupal_theme_access($theme) {
  * Initializes the theme system by loading the theme.
  */
 function drupal_theme_initialize() {
+  global $drupal_theme_init;
+  if (isset($drupal_theme_init) && !$drupal_theme_init) {
+    return;
+  }
   global $theme, $user, $theme_key;
 
   // If $theme is already set, assume the others are set, too, and do nothing
@@ -253,6 +257,10 @@ function _drupal_theme_initialize($theme, $base_theme = array(), $registry_callb
  *   class.
  */
 function theme_get_registry($complete = TRUE) {
+  global $drupal_theme_init;
+  if (isset($drupal_theme_init) && !$drupal_theme_init) {
+    return array();
+  }
   // Use the advanced drupal_static() pattern, since this is called very often.
   static $drupal_static_fast;
   if (!isset($drupal_static_fast)) {
