make byteStream a threadlocal