fix finish condition