add flush at every write command