         break if not can_split
         found = new Buffer(min(buflen, pos))
         rest = new Buffer(max(0, buflen - cur.length - pos))
-        @buffer.copy(found, 0, 0, min(buflen, pos))
-        @buffer.copy(rest, 0, min(buflen, pos + cur.length))
-        @buffer = rest
+        buffer.copy(found, 0, 0, min(buflen, pos))
+        buffer.copy(rest, 0, min(buflen, pos + cur.length))
+        buffer = rest
         @emit('split', found, cur)
-        break if not @enabled or @buffer.length is 0
+        break if not @enabled or buffer.length is 0
+    buffer
 
 
 class BufferStream extends Stream

{ min, max } = Math


split = () ->
    return unless @buffer.length
    can_split = yes
    while can_split
        cur = null
        pos = buflen = @buffer.length
        for splitter in @splitters
            continue if buflen < splitter.length
            i = buffertools.indexOf.call(@buffer, splitter)
            if i isnt -1 and i < pos and i < buflen
                cur = splitter
                pos = i

        if @size is 'flexible'
            if @enabled or @paused
                @buffer = concat_(@buffer, buffer)
                @buffer = split.call(this, @buffer)
            else if not @paused
                @emit('data', buffer)
            yes # it's safe to immediately write again
