diff --git a/src/ComputingTasks.cc b/src/ComputingTasks.cc
index 2515a9fdc2b851b4ce4655e36c6fd2bcb49e4aa5..e7ce5678e9ac8e031697668df1c27b29a67e2a8b 100644
--- a/src/ComputingTasks.cc
+++ b/src/ComputingTasks.cc
@@ -750,13 +750,11 @@ DetCondForecast::writeOutput(ostream &output, const string &basename, bool minim
   if (linear_decomposition)
     {
       output << "first_order_solution_to_compute = 1;" << endl
-             << "if exist('oo_')" << endl
-             << "  if isfield(oo_, 'dr')" << endl
+             << "if isfield(oo_, 'dr')" << endl
              << "    if isfield(oo_.dr, 'ghx') && isfield(oo_.dr, 'ghu') && isfield(oo_.dr, 'state_var') && isfield(oo_.dr, 'order_var')" << endl
-             << "      first_order_solution_to_compute = 0;" << endl
-             << "    end;" << endl
-             << "  end;" << endl
-             << "end;" << endl
+             << "        first_order_solution_to_compute = 0;" << endl
+             << "    end" << endl
+             << "end" << endl
              << "if first_order_solution_to_compute" << endl
              << "  fprintf('%s','Computing the first order solution ...');" << endl
              << "  options_.nograph = true;" << endl
@@ -773,7 +771,7 @@ DetCondForecast::writeOutput(ostream &output, const string &basename, bool minim
              << "  info = stoch_simul(var_list_);" << endl
              << R"(  fprintf('%s\n','done');)" << endl
              << "  options_.periods = tmp_periods;" << endl
-             << "end;" << endl;
+             << "end" << endl;
     }
   vector<string> symbols = symbol_list.get_symbols();
   if (symbols.size() > 0)