fixing stream not written to disk