diff --git a/matlab/perfect-foresight-models/perfect_foresight_solver.m b/matlab/perfect-foresight-models/perfect_foresight_solver.m
index 1f8e967b0f7a05ea15495d537d28e1f0d3cc34d4..e9012634a1d2df93f8eb83c17853881503a907db 100644
--- a/matlab/perfect-foresight-models/perfect_foresight_solver.m
+++ b/matlab/perfect-foresight-models/perfect_foresight_solver.m
@@ -567,7 +567,7 @@ if ~isempty(controlled_paths_by_period)
         % Handle guess values for endogenized exos
         exo_ids = controlled_paths_by_period(p).endogenize_id;
         if ~isempty(options_.simul.homotopy_exclude_varexo)
-            [is_excluded, excluded_exo_ids] = ismember(options_.simul.homotopy_exclude_varexo, M_.exo_names{exo_ids});
+            [is_excluded, excluded_exo_ids] = ismember(options_.simul.homotopy_exclude_varexo, M_.exo_names(exo_ids));
             if any(is_excluded)
                 error('Exogenous %s cannot be in the homotopy_exclude_varexo option and a perfect_foresight_controlled_paths block at the same time', M_.exo_names{excluded_exo_ids(1)})
             end