diff --git a/src/DynamicModel.cc b/src/DynamicModel.cc
index b32617c550ec5b6033397f9cbeeb0363b2a38560..90a1d1f6db6d25b22070673457cc88ec69a5ffb8 100644
--- a/src/DynamicModel.cc
+++ b/src/DynamicModel.cc
@@ -5541,10 +5541,11 @@ DynamicModel::transformPredeterminedVariables()
 
   for (auto &equation : equations)
     {
-      auto substeq = dynamic_cast<BinaryOpNode *>(equation->decreaseLeadsLagsPredeterminedVariables());
-      assert(substeq);
-      equation = substeq;
+      equation = dynamic_cast<BinaryOpNode *>(equation->decreaseLeadsLagsPredeterminedVariables());
+      assert(equation);
     }
+
+  // No need to handle static_only_equations, since there are no leads/lags there
 }
 
 void