diff --git a/modules/system/system.module b/modules/system/system.module
index 5af9ad4..2397de4 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -2406,6 +2406,10 @@ function _system_rebuild_module_data() {
  *   Array of all available modules and their data.
  */
 function system_rebuild_module_data() {
+  if (!module_load_all(NULL)) {
+    throw new Exception('Insufficient bootstrap phase.');
+  }
+
   $modules_cache = &drupal_static(__FUNCTION__);
   // Only rebuild once per request. $modules and $modules_cache cannot be
   // combined into one variable, because the $modules_cache variable is reset by
@@ -2559,6 +2563,10 @@ function _system_rebuild_theme_data() {
  *   Array of all available themes and their data.
  */
 function system_rebuild_theme_data() {
+  if (!module_load_all(NULL)) {
+    throw new Exception('Insufficient bootstrap phase.');
+  }
+
   $themes = _system_rebuild_theme_data();
   ksort($themes);
   system_get_files_database($themes, 'theme');
diff --git a/update.php b/update.php
index ac594ff..0aeebb8 100644
--- a/update.php
+++ b/update.php
@@ -379,6 +379,10 @@ if (empty($op) && update_access_allowed()) {
   // in updated code are picked up.
   module_implements('', FALSE, TRUE);
 
+  // Rebuild the registry so that any classes moved by modules are rescanned.
+  // @todo Only System module is loaded at this point.
+  registry_rebuild();
+
   // Set up $language, since the installer components require it.
   drupal_language_initialize();
 
