diff --git a/src/SubModel.cc b/src/SubModel.cc
index 38b729baccf4e94cccd5fffc0618649be94950d4..a63ec07c5120ec2c1e8687db9398935d82fe057e 100644
--- a/src/SubModel.cc
+++ b/src/SubModel.cc
@@ -1285,18 +1285,21 @@ PacModelTable::transformPass(const lag_equivalence_table_t& unary_ops_nodes,
 
           // Associate the coefficients of the linear combination with the right components
           for (auto [var, coeff] : terms)
-            if (auto it = find_if(
-                    components.begin(), components.end(),
-                    [&](const auto& v) { return get<0>(v) == dynamic_model.AddVariable(var); });
-                it != components.end())
-              get<4>(*it) = coeff;
-            else
-              {
-                cerr << "ERROR: the model equation defining the 'target' of 'pac_target_info("
-                     << name << ")' contains a variable (" << symbol_table.getName(var)
-                     << ") that is not declared as a 'component'" << endl;
-                exit(EXIT_FAILURE);
-              }
+	    {
+	      auto var1 = var;
+	      if (auto it = find_if(
+				    components.begin(), components.end(),
+				    [&](const auto &v) { return get<0>(v) == dynamic_model.AddVariable(var1); });
+		  it != components.end())
+		get<4>(*it) = coeff;
+	      else
+		{
+		  cerr << "ERROR: the model equation defining the 'target' of 'pac_target_info("
+		       << name << ")' contains a variable (" << symbol_table.getName(var1)
+		       << ") that is not declared as a 'component'" << endl;
+		  exit(EXIT_FAILURE);
+		}
+	    }
 
           // Verify that all declared components appear in that equation
           for (const auto& [component, growth_component, auxname, kind, coeff,