flushing output after every write to stream
changed buffer size