diff --git a/ParsingDriver.cc b/ParsingDriver.cc
index 3ca5a401b96e52d8536b65fbfaa587a77267d993..42ac5cdf20f60975bc009fdb62273e359b30c392 100644
--- a/ParsingDriver.cc
+++ b/ParsingDriver.cc
@@ -2098,7 +2098,7 @@ ParsingDriver::plot_conditional_forecast(string *periods)
 void
 ParsingDriver::conditional_forecast_paths()
 {
-  mod_file->addStatement(new ConditionalForecastPathsStatement(det_shocks));
+  mod_file->addStatement(new ConditionalForecastPathsStatement(det_shocks, mod_file->symbol_table));
   det_shocks.clear();
 }
 
diff --git a/Shocks.cc b/Shocks.cc
index 37b64eea838c1b8fb65ff7b428978f4fdca8a576..9cea0e2d8887bbde456b831307142e05b1a4512f 100644
--- a/Shocks.cc
+++ b/Shocks.cc
@@ -352,8 +352,10 @@ MShocksStatement::writeOutput(ostream &output, const string &basename, bool mini
   writeDetShocks(output);
 }
 
-ConditionalForecastPathsStatement::ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg) :
+ConditionalForecastPathsStatement::ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg,
+                                                                     const SymbolTable &symbol_table_arg) :
   paths(paths_arg),
+  symbol_table(symbol_table_arg),
   path_length(-1)
 {
 }
@@ -393,11 +395,11 @@ ConditionalForecastPathsStatement::writeOutput(ostream &output, const string &ba
     {
       if (it == paths.begin())
         {
-          output << "constrained_vars_ = " << it->first +1 << ";" << endl;
+          output << "constrained_vars_ = " << symbol_table.getTypeSpecificID(it->first) + 1 << ";" << endl;
         }
       else
         {
-          output << "constrained_vars_ = [constrained_vars_; " << it->first +1 << "];" << endl;
+          output << "constrained_vars_ = [constrained_vars_; " << symbol_table.getTypeSpecificID(it->first) + 1 << "];" << endl;
         }
 
 
diff --git a/Shocks.hh b/Shocks.hh
index b29477c4aa8186dcf9c6f0ee8dce5088af7ea9da..f89e1fba1ec51d035aa4707129c84c8e59720bb3 100644
--- a/Shocks.hh
+++ b/Shocks.hh
@@ -94,9 +94,11 @@ class ConditionalForecastPathsStatement : public Statement
 {
 private:
   const AbstractShocksStatement::det_shocks_t paths;
+  const SymbolTable &symbol_table;
   int path_length;
 public:
-  ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg);
+  ConditionalForecastPathsStatement(const AbstractShocksStatement::det_shocks_t &paths_arg,
+                                    const SymbolTable &symbol_table_arg);
   virtual void checkPass(ModFileStructure &mod_file_struct, WarningConsolidation &warnings);
   virtual void writeOutput(ostream &output, const string &basename, bool minimal_workspace) const;
 };