diff --git a/og_theme.module b/og_theme.module
index 05a6562..30c1649 100644
--- a/og_theme.module
+++ b/og_theme.module
@@ -52,6 +52,9 @@ function og_theme_og_fields_info() {
  * Change the theme, based on a group context.
  */
 function og_theme_custom_theme() {
+  // Force purl initialize earlier so that the og context will be set.
+  purl_init();
+
   if ($group = og_context()) {
     // Load the entity.
     $entity = $group->getEntity();
