diff --git a/ComputingTasks.cc b/ComputingTasks.cc
index 2c2b5668b0f128e84d0537c8c3a1a6d396fdb9c7..241062d74684e36c6b2b281695490b121cd06fd4 100644
--- a/ComputingTasks.cc
+++ b/ComputingTasks.cc
@@ -135,6 +135,15 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct)
       cerr << "ERROR: in 'stoch_simul', you cannot use option 'pruning' with 'k_order_solver' option or with 3rd order approximation" << endl;
       exit(EXIT_FAILURE);
     }
+
+  // Workaround for ticket #157
+  it = options_list.num_options.find("periods");
+  if (it != options_list.num_options.end() && atoi(it->second.c_str()) > 0
+      && mod_file_struct.histval_present)
+    {
+      cerr << "ERROR: the 'periods' option of 'stoch_simul' is not compatible with a 'histval' block" << endl;
+      exit(EXIT_FAILURE);
+    }
 }
 
 void
diff --git a/NumericalInitialization.cc b/NumericalInitialization.cc
index 9a67b05fa2524ba9aacbd8b284bd8854b76dee33..6b08a74eb4c3292beb4dc6d74586cf344b8a9af5 100644
--- a/NumericalInitialization.cc
+++ b/NumericalInitialization.cc
@@ -177,6 +177,12 @@ HistValStatement::HistValStatement(const hist_values_t &hist_values_arg,
 {
 }
 
+void
+HistValStatement::checkPass(ModFileStructure &mod_file_struct)
+{
+  mod_file_struct.histval_present = true;
+}
+
 void
 HistValStatement::writeOutput(ostream &output, const string &basename) const
 {
diff --git a/NumericalInitialization.hh b/NumericalInitialization.hh
index bde6a7eceb4ae7558871068e9f8ab1a4c80f2e8a..b9639af910314d09849272c91b83ce6325889744 100644
--- a/NumericalInitialization.hh
+++ b/NumericalInitialization.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2003-2010 Dynare Team
+ * Copyright (C) 2003-2011 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -100,6 +100,8 @@ private:
 public:
   HistValStatement(const hist_values_t &hist_values_arg,
                    const SymbolTable &symbol_table_arg);
+  //! Workaround for trac ticket #157
+  virtual void checkPass(ModFileStructure &mod_file_struct);
   virtual void writeOutput(ostream &output, const string &basename) const;
 };
 
diff --git a/Statement.cc b/Statement.cc
index 0c070c1081053a2852e47b07155e8a8b8c1c283f..8cff67d989ac1268067c73f24212a7f41d0f4a55 100644
--- a/Statement.cc
+++ b/Statement.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2010 Dynare Team
+ * Copyright (C) 2006-2011 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -33,6 +33,7 @@ ModFileStructure::ModFileStructure() :
   identification_present(false),
   partial_information(false),
   shocks_present(false),
+  histval_present(false),
   k_order_solver(false),
   calibrated_measurement_errors(false),
   dsge_prior_weight_in_estimated_params(false),
diff --git a/Statement.hh b/Statement.hh
index 5f98d9af9de3757d7e11c0e15a706ed8011221b8..27a8b3d2a7a04f946cfb64aeda98b23a8f71fcc1 100644
--- a/Statement.hh
+++ b/Statement.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2010 Dynare Team
+ * Copyright (C) 2006-2011 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -61,6 +61,9 @@ public:
   //! Whether a shocks or mshocks block is present
   /*! Used for the workaround for trac ticket #35 */
   bool shocks_present;
+  //! Whether a histval bloc is present
+  /*! Used for the workaround for trac ticket #157 */
+  bool histval_present;
   //! Whether the "k_order_solver" option is used (explictly, or implicitly if order >= 3)
   bool k_order_solver;
   //! Whether there is a calibrated measurement error