Index: /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/guimodel/AbstractDefaultGUIElementTest.java
===================================================================
--- /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/guimodel/AbstractDefaultGUIElementTest.java	(revision 1435)
+++ /trunk/autoquest-core-events-test/src/test/java/de/ugoe/cs/autoquest/eventcore/guimodel/AbstractDefaultGUIElementTest.java	(revision 1436)
@@ -69,5 +69,4 @@
                 assertFalse(guiElements[i].equals(guiElements[j]));
                 assertFalse(guiElements[j].equals(guiElements[i]));
-                assertNotSame(guiElements[i].hashCode(), guiElements[j].hashCode());
             }
         }
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 1435)
+++ /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 1435)
+++ /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;
     }
Index: /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLDocumentSpec.java
===================================================================
--- /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLDocumentSpec.java	(revision 1435)
+++ /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLDocumentSpec.java	(revision 1436)
@@ -77,5 +77,7 @@
      */
     public HTMLDocumentSpec(HTMLServerSpec server, String path, String query, String title) {
-        super("document");
+        super("document", (server != null ? server.hashCode() : 0) +
+              (path != null ? path.hashCode() : 0) + (query != null ? query.hashCode() : 0) +
+              (title != null ? title.hashCode() : 0));
         
         if (server == null) {
Index: /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLGUIElementSpec.java
===================================================================
--- /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLGUIElementSpec.java	(revision 1435)
+++ /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLGUIElementSpec.java	(revision 1436)
@@ -40,4 +40,11 @@
      */
     private String type;
+
+    /**
+     * <p>
+     * the hashCode of this GUI element specification
+     * </p>
+     */
+    private int hashCode;
     
     /**
@@ -50,5 +57,5 @@
      * @throws IllegalArgumentException if the provided type is null
      */
-    public HTMLGUIElementSpec(String type) {
+    public HTMLGUIElementSpec(String type, int hashCode) {
         if (type == null) {
             throw new IllegalArgumentException("type must not be null");
@@ -56,4 +63,5 @@
 
         this.type = type;
+        this.hashCode = hashCode;
     }
 
@@ -87,3 +95,11 @@
     }
 
+    /* (non-Javadoc)
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return hashCode;
+    }
+
 }
Index: /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLPageElementSpec.java
===================================================================
--- /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLPageElementSpec.java	(revision 1435)
+++ /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLPageElementSpec.java	(revision 1436)
@@ -83,5 +83,7 @@
      */
     public HTMLPageElementSpec(HTMLDocumentSpec page, String tagName, String htmlId, int index) {
-        super(tagName);
+        super(tagName, (page != null ? page.hashCode() : 0) +
+              (tagName != null ? tagName.hashCode() : 0) + 
+              (htmlId != null ? htmlId.hashCode() : 0) + (index >= 0 ? index : 0));
         
         if (page == null) {
Index: /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLServerSpec.java
===================================================================
--- /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLServerSpec.java	(revision 1435)
+++ /trunk/autoquest-plugin-html/src/main/java/de/ugoe/cs/autoquest/plugin/html/guimodel/HTMLServerSpec.java	(revision 1436)
@@ -59,5 +59,5 @@
      */
     public HTMLServerSpec(String host, int port) {
-        super("server");
+        super("server", (host != null ? host.hashCode() : 0) + port);
         
         if (host == null) {
