fix ai flow