we only need to flush one time at the end.