diff --git a/metatag.module b/metatag.module
index ce1514c..fdbebdb 100644
--- a/metatag.module
+++ b/metatag.module
@@ -730,21 +730,29 @@ function metatag_load_entity_from_path($path) {
  * Implements hook_page_build().
  */
 function metatag_page_build(&$page) {
+  global $theme;
+  
+  // retrieve main region
+  $select = db_select('block')->where('module = :module AND delta = :delta AND theme = :theme', array(':module' => 'system', ':delta' => 'main', ':theme' => $theme));
+  $select->addField('block', 'region');
+  $result = $select->execute();
+  $mainRegion = $result->fetchColumn();
+	
   // For some reason with Overlay enabled we get an empty $page, so just fail
   // this case.
-  if (!isset($page['content'])) {
+  if (!isset($page[$mainRegion])) {
     return;
   }
 
   // Load the metatags render array in before any page content so that more
   // more specific meta tags in the page content can override these meta tags.
-  $page['content'] = array('metatags' => array()) + $page['content'];
+  $page[$mainRegion] = array('metatags' => array()) + $page[$mainRegion];
   if (drupal_is_front_page()) {
-    $page['content']['metatags']['global:frontpage'] = metatag_metatags_view('global:frontpage', array());
+    $page[$mainRegion]['metatags']['global:frontpage'] = metatag_metatags_view('global:frontpage', array());
   }
   elseif (!path_is_admin(current_path())) {
     // Do not output the global metatags when on an administration path.
-    $page['content']['metatags']['global'] = metatag_metatags_view('global', array());
+    $page[$mainRegion]['metatags']['global'] = metatag_metatags_view('global', array());
   }
 }
 
