fix #3424 (only the first 256K stream chunk was being written)