diff --git a/core/src/main/java/io/undertow/server/handlers/cache/DirectBufferCache.java b/core/src/main/java/io/undertow/server/handlers/cache/DirectBufferCache.java
index 24ddf535e..429021f30 100644
--- a/core/src/main/java/io/undertow/server/handlers/cache/DirectBufferCache.java
+++ b/core/src/main/java/io/undertow/server/handlers/cache/DirectBufferCache.java
@@ -28,6 +28,7 @@ import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
 import java.util.concurrent.ConcurrentHashMap;
 
+//import io.undertow.UndertowLogger;
 import io.undertow.util.ConcurrentDirectDeque;
 import org.xnio.BufferAllocator;
 
@@ -75,6 +76,8 @@ public class DirectBufferCache {
     }
 
     public CacheEntry add(Object key, int size, int maxAge) {
+//        if(key.toString().contains("size=28"))
+//            new Exception(key+"").printStackTrace();
         CacheEntry value = cache.get(key);
         if (value == null) {
             value = new CacheEntry(key, size, this, maxAge);
@@ -90,14 +93,20 @@ public class DirectBufferCache {
     }
 
     public CacheEntry get(Object key) {
+//        final StringBuilder sb = new StringBuilder();
+//                sb.append("-------------\n").append(key).append("\n");
+        try {
         CacheEntry cacheEntry = cache.get(key);
+//        sb.append("DBC[1]:").append(cacheEntry).append("\n");
         if (cacheEntry == null) {
             return null;
         }
 
         long expires = cacheEntry.getExpires();
+//        sb.append("DBC[2]:").append(expires).append("\n");
         if(expires != -1) {
             if(System.currentTimeMillis() > expires) {
+  //              sb.append("DBC[2.5]:").append("\n");
                 remove(key);
                 return null;
             }
@@ -118,7 +127,7 @@ public class DirectBufferCache {
                     if (oldest.buffers().length > 0) {
                         reclaimSize -= oldest.size();
                     }
-
+  //                  sb.append("DBC[3]:").append(key).append("-").append(oldest.key()).append("\n");
                     this.remove(oldest.key());
 
                     if (reclaimSize <= 0) {
@@ -130,8 +139,11 @@ public class DirectBufferCache {
                 cacheEntry.allocate();
             }
         }
-
+//        sb.append("DBC[4]:").append("\n");
         return cacheEntry;
+        } finally {
+  //          UndertowLogger.ROOT_LOGGER.error(sb);
+        }
     }
 
     /**
@@ -166,6 +178,8 @@ public class DirectBufferCache {
 
 
     public void remove(Object key) {
+//        if(key.toString().contains("size=28"))
+//        new Exception(key+"").printStackTrace();
         CacheEntry remove = cache.remove(key);
         if (remove != null) {
             Object old = remove.clearToken();
@@ -234,6 +248,7 @@ public class DirectBufferCache {
         }
 
         public void enable() {
+            new Exception(this.toString()).printStackTrace();
             if(maxAge == -1) {
                 this.expires = -1;
             } else {
@@ -351,5 +366,12 @@ public class DirectBufferCache {
         long getExpires() {
             return expires;
         }
+
+        @Override
+        public String toString() {
+            return "CacheEntry [key=" + key + ", size=" + size + ", maxAge=" + maxAge + ", enabled=" + enabled + ", expires="
+                    + expires + " current="+System.currentTimeMillis()+"]@"+this.hashCode();
+        }
+
     }
 }
diff --git a/core/src/main/java/io/undertow/server/handlers/resource/CachedResource.java b/core/src/main/java/io/undertow/server/handlers/resource/CachedResource.java
index a471653b0..de26c2bd1 100644
--- a/core/src/main/java/io/undertow/server/handlers/resource/CachedResource.java
+++ b/core/src/main/java/io/undertow/server/handlers/resource/CachedResource.java
@@ -149,6 +149,7 @@ public class CachedResource implements Resource, RangeAwareResource {
         }
         //it is not cached yet, install a wrapper to grab the data
         if (existing == null || !existing.enabled() || !existing.reference()) {
+            UndertowLogger.ROOT_LOGGER.error("XXXX --"+length+"-- XXXX");
             Sender newSender = sender;
 
             final DirectBufferCache.CacheEntry entry;
@@ -168,6 +169,7 @@ public class CachedResource implements Resource, RangeAwareResource {
             underlyingResource.serve(newSender, exchange, completionCallback);
         } else {
             UndertowLogger.REQUEST_LOGGER.tracef("Serving resource %s from the buffer cache to %s", name, exchange);
+            UndertowLogger.ROOT_LOGGER.error("YYYY ----- YYYY");
             //serve straight from the cache
             ByteBuffer[] buffers;
             boolean ok = false;
@@ -190,17 +192,23 @@ public class CachedResource implements Resource, RangeAwareResource {
 
     @Override
     public Long getContentLength() {
+        UndertowLogger.ROOT_LOGGER.error("--- getContentLength: "+getPath()+" "+getCacheKey()+" ---");
         //we always use the underlying size unless the data is cached in the buffer cache
         //to prevent a mis-match between size on disk and cached size
         final DirectBufferCache dataCache = cachingResourceManager.getDataCache();
+        UndertowLogger.ROOT_LOGGER.error("[1]> "+dataCache+" - "+underlyingResource);
         if(dataCache == null) {
+            UndertowLogger.ROOT_LOGGER.error("[1.5]> "+underlyingResource.getContentLength());
             return underlyingResource.getContentLength();
         }
         final DirectBufferCache.CacheEntry existing = dataCache.get(cacheKey);
+        UndertowLogger.ROOT_LOGGER.error("[2]> "+existing);
         if(existing == null || !existing.enabled()) {
+            UndertowLogger.ROOT_LOGGER.error("[2]> "+underlyingResource.getContentLength());
             return underlyingResource.getContentLength();
         }
         //we only return the
+        UndertowLogger.ROOT_LOGGER.error("[3]> "+existing.size());
         return (long)existing.size();
     }
 
diff --git a/core/src/main/java/io/undertow/util/HeaderMap.java b/core/src/main/java/io/undertow/util/HeaderMap.java
index a6b7bc6b3..769a22e34 100644
--- a/core/src/main/java/io/undertow/util/HeaderMap.java
+++ b/core/src/main/java/io/undertow/util/HeaderMap.java
@@ -702,8 +702,15 @@ public final class HeaderMap implements Iterable<HeaderValues> {
         return this;
     }
 
+    private static int COUNTER = 0;
     public HeaderMap addLast(final HttpString headerName, final String headerValue) {
         checkNotNullParam("headerName", headerName);
+        if(headerName.toString().equals("Content-Length") && !headerValue.equals("0")) {
+            COUNTER++;
+            if(COUNTER%3 != 1 && Integer.parseInt(headerValue) == 28) {
+                new Exception("-x-:"+COUNTER);
+            }
+        }
         if (headerValue == null) {
             return this;
         }
@@ -727,9 +734,15 @@ public final class HeaderMap implements Iterable<HeaderValues> {
     }
 
     // put
-
+    private static int COUNTER2 = 0;
     public HeaderMap put(HttpString headerName, String headerValue) {
         checkNotNullParam("headerName", headerName);
+        if(headerName.toString().equals("Content-Length") && !headerValue.equals("0")) {
+            COUNTER2++;
+            if(COUNTER2%3 != 1 && Integer.parseInt(headerValue) == 28) {
+                new Exception("-xy-:"+COUNTER2);
+            }
+        }
         if (headerValue == null) {
             remove(headerName);
             return this;
