 					buffer = UnsafeMutablePointer<UInt8>.allocate(capacity: bufferSize)
 //					if buffer == nil {throw BufferStreamError.cannotAllocateMemory(size)}
 					buffer.assign(from: bufferStart, count: bufferValidLength)
+					bufferStart = buffer
 					
 					if oldBuffer != defaultSizedBuffer {oldBuffer.deallocate(capacity: oldBufferSize)}
 				}

				if bufferStartPos > 0 {
					/* We can move the data to the beginning of the buffer. */
					assert(bufferStart != buffer)
					buffer.assign(from: bufferStart, count: bufferValidLength); bufferStartPos = 0
				} else {
					/* The buffer is not big enough anymore. We need to create a new,
					 * bigger one. */

		var searchOffset = 0
		repeat {
			assert(bufferValidLength - searchOffset >= 0)
			var bufferStart = buffer.advanced(by: bufferStartPos)
			let bufferSearchData = Data(bytesNoCopy: bufferStart.advanced(by: searchOffset), count: bufferValidLength - searchOffset, deallocator: .none)
			if let matchedLength = matchDelimiters(inData: bufferSearchData, usingMatchingMode: matchingMode, includeDelimiter: includeDelimiter, minDelimiterLength: minDelimiterLength, withUnmatchedDelimiters: &unmatchedDelimiters, matchedDatas: &matchedDatas) {
				let returnedLength = searchOffset + matchedLength
				bufferStartPos += returnedLength
				bufferValidLength -= returnedLength
				currentReadPosition += returnedLength
