diff --git a/preprocessor/DataTree.cc b/preprocessor/DataTree.cc
index 7452b63b77b3a7480477ad17fcd423895431a2bd..a967a3ed6f59414b3467b3470444a8f12d3fef94 100644
--- a/preprocessor/DataTree.cc
+++ b/preprocessor/DataTree.cc
@@ -536,7 +536,7 @@ DataTree::isUnaryOpUsed(UnaryOpcode opcode) const
 {
   for (unary_op_node_map_t::const_iterator it = unary_op_node_map.begin();
        it != unary_op_node_map.end(); it++)
-    if (it->first.second == opcode)
+    if (it->first.first.second == opcode)
       return true;
 
   return false;
diff --git a/preprocessor/DataTree.hh b/preprocessor/DataTree.hh
index 5d75de0cdb8c3799a846b8e38f437aa78295d0ac..f49460ae86a79f2a7ff5a665f320d48f0baa7afe 100644
--- a/preprocessor/DataTree.hh
+++ b/preprocessor/DataTree.hh
@@ -59,7 +59,8 @@ protected:
   //! Pair (symbol_id, lag) used as key
   typedef map<pair<int, int>, VariableNode *> variable_node_map_t;
   variable_node_map_t variable_node_map;
-  typedef map<pair<expr_t, UnaryOpcode>, UnaryOpNode *> unary_op_node_map_t;
+  //! Pair( Pair (arg1, UnaryOpCode), Pair(Expectation Info Set, Expectation Info Set Name) )
+  typedef map<pair<pair<expr_t, UnaryOpcode>, pair<int, string> >, UnaryOpNode *> unary_op_node_map_t;
   unary_op_node_map_t unary_op_node_map;
   typedef map<pair<pair<expr_t, expr_t>, BinaryOpcode>, BinaryOpNode *> binary_op_node_map_t;
   binary_op_node_map_t binary_op_node_map;
@@ -263,7 +264,7 @@ inline expr_t
 DataTree::AddUnaryOp(UnaryOpcode op_code, expr_t arg, int arg_exp_info_set, const string &arg_exp_info_set_name)
 {
   // If the node already exists in tree, share it
-  unary_op_node_map_t::iterator it = unary_op_node_map.find(make_pair(arg, op_code));
+  unary_op_node_map_t::iterator it = unary_op_node_map.find(make_pair(make_pair(arg, op_code), make_pair(arg_exp_info_set, arg_exp_info_set_name)));
   if (it != unary_op_node_map.end())
     return it->second;
 
diff --git a/preprocessor/ExprNode.cc b/preprocessor/ExprNode.cc
index 0569dbd5fd2eebeacf9bf6d8edce436be0fffc0a..39356b10ebb75fbdb957922907c0179e3a1addc1 100644
--- a/preprocessor/ExprNode.cc
+++ b/preprocessor/ExprNode.cc
@@ -1192,7 +1192,8 @@ UnaryOpNode::UnaryOpNode(DataTree &datatree_arg, UnaryOpcode op_code_arg, const
   op_code(op_code_arg)
 {
   // Add myself to the unary op map
-  datatree.unary_op_node_map[make_pair(arg, op_code)] = this;
+  datatree.unary_op_node_map[make_pair(make_pair(arg, op_code),
+                                       make_pair(expectation_information_set, expectation_information_set_name))] = this;
 }
 
 void
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 4455413c1ccf3788c7f3589cd6c8b5e8700f5f40..0f74f47d58e22832293c939185691428db7fde69 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,6 +19,7 @@ MODS = \
 	comments.mod \
 	histval_sto.mod \
 	histval_det.mod \
+	expectation.mod \
 	steady_state_operator/standard.mod \
 	steady_state_operator/use_dll.mod \
 	steady_state_operator/block.mod \
diff --git a/tests/expectation.mod b/tests/expectation.mod
new file mode 100644
index 0000000000000000000000000000000000000000..696eba4da7b087297b59c9a2d5f6bd8c649b0054
--- /dev/null
+++ b/tests/expectation.mod
@@ -0,0 +1,44 @@
+// Example 1 from Collard's guide to Dynare
+var y, c, k, a, h, b;
+varexo e, u;
+
+parameters beta, rho, alpha, delta, theta, psi, tau;
+
+alpha = 0.36;
+rho   = 0.95;
+tau   = 0.025;
+beta  = 0.99;
+delta = 0.025;
+psi   = 0;
+theta = 2.95;
+
+phi   = 0.1;
+
+model;
+c*theta*h^(1+psi)=expectation(1)((1-alpha)*y)+expectation(-2)((1-alpha)*y);
+k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1)))
+    *(exp(b(+1))*alpha*y(+1)+(1-delta)*k));
+y = exp(a)*(k(-1)^alpha)*(h^(1-alpha));
+k = exp(b)*(y-c)+(1-delta)*k(-1);
+a = rho*a(-1)+tau*b(-1) + e;
+b = tau*a(-1)+rho*b(-1) + u;
+end;
+
+initval;
+y = 1.08068253095672;
+c = 0.80359242014163;
+h = 0.29175631001732;
+k = 11.08360443260358;
+a = 0;
+b = 0;
+e = 0;
+u = 0;
+end;
+
+shocks;
+var e; stderr 0.009;
+var u; stderr 0.009;
+var e, u = phi*0.009*0.009;
+end;
+
+stoch_simul;