diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index 5fafda9ec826fe092acdd95ec0efd0b959c1c485..7c290d29af5c11151076ce7ebb14c5ad0e7cda3e 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -3794,6 +3794,41 @@ Smoother2histvalStatement::Smoother2histvalStatement(const OptionsList &options_
 {
 }
 
+Statement *
+Smoother2histvalStatement::cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table)
+{
+  SymbolList new_options_symbol_list;
+  OptionsList new_options_list = options_list;
+  try
+    {
+      SymbolTable *new_symbol_table =  dynamic_datatree.getSymbolTable();
+      string opts_to_check[] = {"invars", "outvars"};
+      vector<string> opts (opts_to_check, opts_to_check + sizeof(opts_to_check)/sizeof(string));
+      for (vector<string>::const_iterator it=opts.begin(); it != opts.end(); it++)
+        {
+          OptionsList::symbol_list_options_t::const_iterator it1 =
+            options_list.symbol_list_options.find(*it);
+          if (it1 != options_list.symbol_list_options.end())
+            {
+              vector<string> symbols = it1->second.get_symbols();
+              for (vector<string>::const_iterator it2 = symbols.begin(); it2 != symbols.end(); it2++)
+                {
+                  new_symbol_table->getID(*it2);
+                  new_options_symbol_list.addSymbol(*it2);
+                }
+              new_options_list.symbol_list_options[*it] = new_options_symbol_list;
+            }
+        }
+    }
+  catch (...)
+    {
+      cerr << "ERROR: A variable in the smoother2histval statement was not found in the symbol table" << endl
+           << "       This likely means that you have declared a varexo that is not used in the model" << endl;
+      exit(EXIT_FAILURE);
+    }
+  return new Smoother2histvalStatement(new_options_list);
+}
+
 void
 Smoother2histvalStatement::writeOutput(ostream &output, const string &basename) const
 {
diff --git a/ComputingTasks.hh b/ComputingTasks.hh
index 7f17a30a97831b536b935ed49bfedfd2f60883fd..a59ad9add8bdb1c02826d54912cc230d93fdd916 100644
--- a/ComputingTasks.hh
+++ b/ComputingTasks.hh
@@ -926,6 +926,7 @@ private:
 public:
   Smoother2histvalStatement(const OptionsList &options_list_arg);
   virtual void writeOutput(ostream &output, const string &basename) const;
+  virtual Statement *cloneAndReindexSymbIds(DataTree &dynamic_datatree, SymbolTable &orig_symbol_table);
 };
 
 #endif