fix finish_flush