diff --git a/domain.module b/domain.module
index 3f2d162..91471a2 100644
--- a/domain.module
+++ b/domain.module
@@ -1123,7 +1123,11 @@ function domain_lookup($domain_id = NULL, $subdomain = NULL, $reset = FALSE) {
  */
 function domain_default($reset = FALSE, $alter = TRUE) {
   $default = &drupal_static(__FUNCTION__);
+  $altered = &drupal_static(__FUNCTION__ . '_altered');
+
   if (empty($default) || $reset) {
+    $altered = FALSE;
+
     // Temporary hack for update to 7.x.3.
     if (db_table_exists('domain_export')) {
       $default = db_query("SELECT domain_id, subdomain, sitename, scheme, valid, weight, is_default, machine_name FROM {domain} WHERE is_default = 1")->fetchAssoc();
@@ -1143,11 +1147,14 @@ function domain_default($reset = FALSE, $alter = TRUE) {
         'machine_name' => domain_machine_name($default['subdomain']),
       );
     }
-    if ($alter) {
-      // Let submodules overwrite the defaults, if they wish.
-      $default = domain_api($default, $reset);
-    }
   }
+
+  // If an altered version is requested, and $default hasn't be altered before.
+  if ($alter && !$altered) {
+    // Let submodules overwrite the defaults, if they wish.
+    $default = domain_api($default, $reset);
+  }
+
   return $default;
 }
 
diff --git a/tests/domain.test b/tests/domain.test
index 5c60853..156117b 100644
--- a/tests/domain.test
+++ b/tests/domain.test
@@ -449,6 +449,17 @@ class DomainUnitTest extends DomainTestCase {
     parent::setUp($list);
   }
 
+  // Test that domain_default() purges the static when needed.
+  function testDomainDefault() {
+    // Reset the static, and don't allow domain_default() to run domain_api().
+    $domain = domain_default(TRUE, FALSE);
+    $this->assertTrue(empty($domain['path']), t('domain_default() didn\'t call domain_api when not being allowed to do so.'));
+
+    // Now call it again and allow domain_default() to run domain_api().
+    $domain = domain_default();
+    $this->assertTrue(!empty($domain['path']), t('domain_default() successfully purged static after being allowed to run domain_api().'));
+  }
+/*
   // Test that domain_node_load() and domain_get_node_domains() functions properly.
   function testDomainGetNodeDomains() {
     $count = db_query("SELECT COUNT(domain_id) FROM {domain}")->fetchField();
@@ -713,7 +724,7 @@ class DomainUnitTest extends DomainTestCase {
     $this->assertTrue(!empty($test_user->domain_user[domain_default_id()]), t('User is dynamically assigned to the default domain.'));
     // TODO: Expand this testing logic.
   }
-
+*/
 }
 
 class DomainCacheTest extends DomainTestCase {
