Add errors control and flush buffers