diff --git a/eu_cookie_compliance.module b/eu_cookie_compliance.module
index 14a906b..b2acd18 100644
--- a/eu_cookie_compliance.module
+++ b/eu_cookie_compliance.module
@@ -331,10 +331,13 @@ function eu_cookie_compliance_page_build(&$page) {
         $load_disabled_scripts .= 'scriptTag.src = ' . drupal_json_encode($script) . ';';
         $load_disabled_scripts .= 'document.body.appendChild(scriptTag);';
       }
+      if (!empty($load_disabled_scripts)) {
+        $load_disabled_scripts .= 'Drupal.attachBehaviors();';
+      }
     }
 
-    drupal_add_js('function euCookieComplianceLoadScripts() {' . $load_disabled_scripts . 'Drupal.attachBehaviors();}', array('type' => 'inline', 'scope' => $script_scope));
-
+    drupal_add_js('function euCookieComplianceLoadScripts() {' . $load_disabled_scripts . '}', array('type' => 'inline', 'scope' => $script_scope));
+	
     // Add the cookie name inline, since Drupal.settings will not be available
     // if the script is loaded in the header.
     drupal_add_js('var eu_cookie_compliance_cookie_name = ' . drupal_json_encode(!empty($popup_settings['cookie_name']) ? $popup_settings['cookie_name'] : '') . ';', array('type' => 'inline', 'scope' => $script_scope));
