--- core-orig.txt	Tue Jun 10 14:49:12 2003
+++ core.c	Tue Jun 10 15:45:20 2003
@@ -3629,25 +3629,36 @@
             return rv;
         }
 
-        /* Must do split before CONCAT */
-        newbb = apr_brigade_split(ctx->b, e);
-
         if (mode == AP_MODE_READBYTES) {
-            APR_BRIGADE_CONCAT(b, ctx->b);
+            // Move buckets from ctx->b to b
+            apr_bucket * f;
+            apr_bucket * next = NULL;
+
+            // There's got to be a more efficient way to do this
+            for (f = APR_BRIGADE_FIRST(ctx->b); f != e; f = next) {
+			    next = APR_BUCKET_NEXT(f);
+
+			    APR_BUCKET_REMOVE(f);
+
+			    APR_BRIGADE_INSERT_TAIL(b, f);
+            }	
         }
         else if (mode == AP_MODE_SPECULATIVE) {
-            apr_bucket *copy_bucket;
-            APR_BRIGADE_FOREACH(e, ctx->b) {
+
+			apr_bucket *copy_bucket;
+
+	        newbb = apr_brigade_split(ctx->b, e);
+			
+			APR_BRIGADE_FOREACH(e, ctx->b) {
                 rv = apr_bucket_copy(e, &copy_bucket);
                 if (rv != APR_SUCCESS) {
                     return rv;
                 }
                 APR_BRIGADE_INSERT_TAIL(b, copy_bucket);
             }
-        }
 
-        /* Take what was originally there and place it back on ctx->b */
-        APR_BRIGADE_CONCAT(ctx->b, newbb);
+			APR_BRIGADE_CONCAT(ctx->b, newbb);
+        }
     }
     return APR_SUCCESS;
 }
@@ -3719,7 +3730,11 @@
                 break;
             }
             if (APR_BUCKET_IS_FLUSH(e)) {
-                more = apr_brigade_split(b, APR_BUCKET_NEXT(e));
+
+                if (e != APR_BRIGADE_LAST(b)) {
+                    more = apr_brigade_split(b, APR_BUCKET_NEXT(e));
+                }
+
                 break;
             }
 
