diff --git a/purl.module b/purl.module
index 955b989..c1dba40 100644
--- a/purl.module
+++ b/purl.module
@@ -780,6 +780,20 @@ function purl_active() {
 }
 
 /**
+ * Implements hook_custom_theme().
+ */
+function purl_custom_theme() {
+  // Since menu_set_custom_theme() is invoked in the bootstrap before we had the
+  // chance to restore the path it is unable to set the admin theme correctly.
+  // This sets the admin theme from the normalized path.
+  // The first permission check is for Drupal core, the second is for the
+  // admin_theme module.
+  if ((user_access('view the administration theme') || user_access('access admin theme')) && path_is_admin(purl_get_normal_path(current_path()))) {
+    return variable_get('admin_theme');
+  }
+}
+
+/**
  * Specialized cache for storing modifier information.
  */
 class purl_cache {
