fixed flushing writeout bug