bug fixes in ChunkedBufferReader; implement Writer interface