Index: trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/AbstractDefaultGUIElement.java
===================================================================
--- trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/AbstractDefaultGUIElement.java	(revision 1433)
+++ trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/AbstractDefaultGUIElement.java	(revision 1436)
@@ -69,4 +69,11 @@
      */
     private GUIModel guiModel;
+    
+    /**
+     * <p>
+     * the hash code of this object
+     * </p>
+     */
+    private int hashCode;
 
     /**
@@ -84,4 +91,11 @@
         this.usageObserved = false;
         setParent(parent);
+        
+        if (specification != null) {
+            this.hashCode = specification.hashCode();
+        }
+        else {
+            this.hashCode = 0;
+        }
     }
 
@@ -135,8 +149,10 @@
                     this.equalGUIElements.add(other);
                     other.equalGUIElements = this.equalGUIElements;
+                    other.hashCode = this.hashCode;
                 }
                 else {
                     addIfNotContained(other.equalGUIElements, this);
                     this.equalGUIElements = other.equalGUIElements;
+                    this.hashCode = other.hashCode;
                 }
             }
@@ -145,4 +161,5 @@
                     addIfNotContained(this.equalGUIElements, other);
                     other.equalGUIElements = this.equalGUIElements;
+                    other.hashCode = this.hashCode;
                 }
                 else if (this.equalGUIElements != other.equalGUIElements) {
@@ -153,7 +170,9 @@
                     for (AbstractDefaultGUIElement candidate : other.equalGUIElements) {
                         candidate.equalGUIElements = this.equalGUIElements;
+                        candidate.hashCode = this.hashCode;
                     }
 
                     other.equalGUIElements = this.equalGUIElements;
+                    other.hashCode = this.hashCode;
                 }
                 // else
@@ -219,14 +238,7 @@
         // implement final, as GUI elements are all singletons and they equal only if they are the
         // same object. If there are several GUI element objects that represent the same GUI element
-        // then they are stored in the list of equal elements. In this case, the hash code of the
-        // list is unique within the system
-        synchronized (AbstractDefaultGUIElement.class) {
-            if (this.equalGUIElements == null) {
-                this.equalGUIElements = new LinkedList<AbstractDefaultGUIElement>();
-                this.equalGUIElements.add(this);
-            }
-            
-            return System.identityHashCode(this.equalGUIElements);
-        }
+        // then they are stored in the list of equal elements. But at least their type is expected
+        // to be equal, so return the hash code of the type.
+        return hashCode;
     }
     
Index: trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIModel.java
===================================================================
--- trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIModel.java	(revision 1433)
+++ trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/guimodel/GUIModel.java	(revision 1436)
@@ -167,4 +167,25 @@
                     result.add(child.guiElement);
                 }
+            }
+        }
+        else {
+            System.out.println("problem");
+            boolean found = false;
+            for (Map.Entry<IGUIElement, TreeNode> entry : allNodes.entrySet()) {
+                if (entry.getKey().equals(guiElement)) {
+                    if (!found) {
+                        System.out.println(guiElement.hashCode() + "  " + entry.getKey().hashCode());
+                        found = true;
+                    }
+                    else {
+                        Console.traceln(Level.SEVERE, "Multiple nodes in the internal GUI model " +
+                                        "match the same GUI element. This should not be the case " +
+                                        "and the GUI model is probably invalid.");
+                    }
+                }
+            }
+            
+            if (!found) {
+                Console.traceln(Level.SEVERE, "GUI element belonging to model not found in model");
             }
         }
@@ -322,4 +343,10 @@
         
         TreeNode parent = findNode(guiElements.get(0).getParent());
+        if (parent == null) {
+            throw new IllegalArgumentException("GUI elements to group must have a parent: parent " +
+                                               "of " + guiElements.get(0) + " is " +
+                                               guiElements.get(0).getParent() + " and not found " +
+                                               "in the model");
+        }
         
         List<TreeNode> nodesToGroup = new LinkedList<TreeNode>();
@@ -450,6 +477,6 @@
 
         if (node1 == null || node2 == null) {
-            throw new IllegalArgumentException(
-                                               "Error while merging nodes: one element is not part of the GUI model!");
+            throw new IllegalArgumentException
+                ("Error while merging nodes: one element is not part of the GUI model!");
         }
 
@@ -645,5 +672,5 @@
         
         allNodes.put(replacement.guiElement, replacement);
-
+        
         return replacement;
     }
