Fix sparse_cg solver when max_iter is specified.