cleaned the stream buffers - memory leak fix