diff --git a/sites/all/modules/ad/adcache.inc b/sites/all/modules/ad/adcache.inc
index 40559fd..7e5ae74 100644
--- a/sites/all/modules/ad/adcache.inc
+++ b/sites/all/modules/ad/adcache.inc
@@ -498,15 +498,16 @@ function adserve_cache_display($ids) {
   }
   $output = preg_replace('&/@HOSTID___&', $replace, $output);
 
-  // there was an error, hide the output in comments
+  // there was an error, hide output
   if (adserve_variable('error')) {
-    $output = "<!-- $output -->";
+    _debug_echo("There was an error ($output), producing no output.");
+  }
+  else {
+    // allow custom text to be displayed before and after advertisement
+    $init_text = adserve_invoke_hook('init_text', 'append');
+    $exit_text = adserve_invoke_hook('exit_text', 'append');
+    $output = $init_text . $output . $exit_text;
   }
-
-  // allow custom text to be displayed before and after advertisement
-  $init_text = adserve_invoke_hook('init_text', 'append');
-  $exit_text = adserve_invoke_hook('exit_text', 'append');
-  $output = $init_text . $output . $exit_text;
 
   _debug_memory();
 
@@ -514,6 +515,9 @@ function adserve_cache_display($ids) {
   switch (adserve_variable('ad_display')) {
     case 'javascript':
     default:
+      if (adserve_variable('error')) {
+        exit(0);
+      }
       $output = str_replace(array("\r", "\n", "<", ">", "&"),
                             array('\r', '\n', '\x3c', '\x3e', '\x26'),
                             addslashes($output));
@@ -536,6 +540,9 @@ function adserve_cache_display($ids) {
       exit(0);
     case 'iframe':
     case 'jquery':
+      if (adserve_variable('error')) {
+        exit(0);
+      }
       if (!adserve_variable('debug')) {
         // Tell the web browser not to cache this frame so the ad refreshes
         // each time the page is viewed.
@@ -556,10 +563,12 @@ function adserve_cache_display($ids) {
       print "$output";
       exit(0);
     case 'raw':
+      if (adserve_variable('error')) {
+        return '';
+      }
       _debug_echo('Output: '. htmlentities($output));
       chdir(adserve_variable('ad_dir'));
       return $output;
-
   }
 
   _debug_echo('Output: '. htmlentities($output));
