Fix stack level too deep when writing to ChunkStream

writing to a ChunkStream throws error "stack level to deep"

this commit fixes the issue