Issue #2212873 by DamienMcKenna: Slightly improve code in hook_page_alter() to make fixing theme integration easier.