add flush for buffers