diff --git a/ModFile.cc b/ModFile.cc
index 766c240468628cf63e65ed1f3d81afe1d65fe3b0..f31baf5f5ef717e3555b86948ce77b926f97fb7c 100644
--- a/ModFile.cc
+++ b/ModFile.cc
@@ -39,7 +39,7 @@ ModFile::ModFile(WarningConsolidation &warnings_arg)
     steady_state_model(symbol_table, num_constants, external_functions_table, static_model),
     linear(false), block(false), byte_code(false), use_dll(false), no_static(false), 
     differentiate_forward_vars(false),
-    nonstationary_variables(false), ramsey_model_orig_eqn_nbr(0),
+    nonstationary_variables(false), orig_eqn_nbr(0),
     warnings(warnings_arg)
 {
 }
@@ -330,6 +330,7 @@ ModFile::transformPass(bool nostrict)
       dynamic_model.removeTrendVariableFromEquations();
     }
 
+  orig_eqn_nbr = dynamic_model.equation_number();
   if (mod_file_struct.ramsey_model_present)
     {
       StaticModel *planner_objective = NULL;
@@ -340,7 +341,6 @@ ModFile::transformPass(bool nostrict)
             planner_objective = pos->getPlannerObjective();
         }
       assert(planner_objective != NULL);
-      ramsey_model_orig_eqn_nbr = dynamic_model.equation_number();
 
       /*
         clone the model then clone the new equations back to the original because
@@ -429,7 +429,7 @@ ModFile::transformPass(bool nostrict)
     cout << "Found " << dynamic_model.equation_number() << " equation(s)." << endl;
   else
     {
-      cout << "Found " << ramsey_model_orig_eqn_nbr  << " equation(s)." << endl;
+      cout << "Found " << orig_eqn_nbr  << " equation(s)." << endl;
       cout << "Found " << dynamic_model.equation_number() << " FOC equation(s) for Ramsey Problem." << endl;
     }
 
@@ -740,8 +740,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
   if (block && !byte_code)
     mOutputFile << "addpath " << basename << ";" << endl;
 
-  if (mod_file_struct.ramsey_model_present)
-    mOutputFile << "M_.orig_eq_nbr = " << ramsey_model_orig_eqn_nbr << ";" << endl;
+  mOutputFile << "M_.orig_eq_nbr = " << orig_eqn_nbr << ";" << endl;
 
   if (dynamic_model.equation_number() > 0)
     {
diff --git a/ModFile.hh b/ModFile.hh
index a561af08efea45f58dade4bbbeb261a5f3a2ad57..465d905eaa819ff10512cc98a52840c48cca1246 100644
--- a/ModFile.hh
+++ b/ModFile.hh
@@ -93,7 +93,7 @@ public:
   eval_context_t global_eval_context;
 
   //! Stores the original number of equations in the model_block
-  int ramsey_model_orig_eqn_nbr;
+  int orig_eqn_nbr;
 
   //! Stores the list of extra files to be transefered during a parallel run
   /*! (i.e. option parallel_local_files of model block) */