diff --git a/CookieAwarePageCache.inc b/CookieAwarePageCache.inc
index a7e7109..f54862d 100644
--- a/CookieAwarePageCache.inc
+++ b/CookieAwarePageCache.inc
@@ -16,6 +16,10 @@ class CookieAwarePageCache extends DrupalDatabaseCache implements DrupalCacheInt
   function prepare_cid($cid) {
     // Make sure we only alter the CID for the page cache.
     if ($this->bin == 'cache_page') {
+      // Do not alter $cid in these cases, we probably want to empty cache_page.
+      if ($cid == '*' OR is_null($cid)) {
+        return $cid;
+      }
       $cookies = variable_get('cookie_aware_page_cache_cookies', array());
       foreach ($cookies as $cookie_name) {
         if (isset($_COOKIE[$cookie_name])) {
@@ -37,7 +41,10 @@ class CookieAwarePageCache extends DrupalDatabaseCache implements DrupalCacheInt
   }
 
   function clear($cid = NULL, $wildcard = FALSE) {
-    $cid = $this->prepare_cid($cid);
+    // Do not alter $cid if we are about to empty cache_page.
+    if ($cid !== '*' OR !is_null($cid)) {
+      $cid = $this->prepare_cid($cid);
+    }
     parent::clear($cid, $wildcard);
   }
 }
