diff --git a/ChangeLog b/ChangeLog
index 9d0f53bac0165ce21384aeed1b11e72f0dfee9c1_Q2hhbmdlTG9n..1a9f3c52176b91f876db8a2a6b4833b6ed4ae496_Q2hhbmdlTG9n 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,4 +2,5 @@
 =================
 
 --
+    * remove_group_var renamed into remove_group_term and fixed implementation
 
@@ -5,5 +6,8 @@
 
-	* fix remove_group_var renamed into remove_group_term and fixed implementation
+    * rql annotator add 'having' list into variable's stinfo, and
+      properly update variable graph
+
+    * new undo_modification context manager on select nodes
 
 2011-06-09  --  0.29.0
     * support != operator for non equality
diff --git a/stcheck.py b/stcheck.py
index 9d0f53bac0165ce21384aeed1b11e72f0dfee9c1_c3RjaGVjay5weQ==..1a9f3c52176b91f876db8a2a6b4833b6ed4ae496_c3RjaGVjay5weQ== 100644
--- a/stcheck.py
+++ b/stcheck.py
@@ -27,7 +27,7 @@
 from rql._exceptions import BadRQLQuery
 from rql.utils import function_description
 from rql.nodes import (Relation, VariableRef, Constant, Not, Exists, Function,
-                       And, Variable, variable_refs, make_relation)
+                       And, Variable, Comparison, variable_refs, make_relation)
 from rql.stmts import Union
 
 
@@ -521,6 +521,23 @@
             for term in node.groupby:
                 for vref in term.get_nodes(VariableRef):
                     bloc_simplification(vref.variable, term)
+            try:
+                vargraph = node.vargraph
+            except AttributeError:
+                vargraph = None
+            # XXX node.having is a list of size 1
+            assert len(node.having) == 1
+            for term in node.having[0].get_nodes(Comparison):
+                for vref in term.iget_nodes(VariableRef):
+                    vref.variable.stinfo.setdefault('having', []).append(term)
+                if vargraph is not None:
+                    lhsvariables = set(vref.name for vref in term.children[0].get_nodes(VariableRef))
+                    rhsvariables = set(vref.name for vref in term.children[1].get_nodes(VariableRef))
+                    for v1 in lhsvariables:
+                        for v2 in rhsvariables:
+                            if v1 != v2:
+                                vargraph.setdefault(v1, []).append(v2)
+                                vargraph.setdefault(v2, []).append(v1)
 
     def rewrite_shared_optional(self, exists, var, identity_rel_scope=None):
         """if variable is shared across multiple scopes, need some tree