diff --git a/advagg.module b/advagg.module
index 6cda6b1..9451d2f 100644
--- a/advagg.module
+++ b/advagg.module
@@ -568,6 +568,9 @@ function _advagg_process_html(&$variables) {
       }
       // Footer scripts
       elseif ($scope == 'footer') {
+        if (!isset($variables['page_bottom']) || !is_string($variables['page_bottom'])) {
+          $variables['page_bottom'] = '';
+        }
         $variables['page_bottom'] .= $scripts;
       }
       // Scripts in other places.
