diff --git a/popups.module b/popups.module
index 2e35c2c..0ae8ac2 100644
--- a/popups.module
+++ b/popups.module
@@ -470,7 +470,7 @@ function popups_theme_settings_form_submit($form, &$form_state) {
 function popups_preprocess_page() {
   $base_path = base_path();
 
-  if (variable_get('preprocess_css', 0)) {
+  if (variable_get('preprocess_css', 0) || module_exists('advagg')) {
     $css_on_page = array();
     foreach (popups_get_css() as $type => $files) {
       foreach ($files as $path => $html) {
@@ -480,7 +480,7 @@ function popups_preprocess_page() {
     $settings['popups']['originalCSS'] = $css_on_page;
   }
 
-  if (variable_get('preprocess_js', 0)) {
+  if (variable_get('preprocess_js', 0) || module_exists('advagg')) {
     $js_on_page = array();
     $js = popups_get_js();
     // We don't care about settings or inline css.
