max_iter termination condition