handle write bug by flushing every 400 bytes