use reset instead of flush to cleanup the stream