xpath BUGFIX adding node hash that is not yet in set
diff --git a/src/xpath.c b/src/xpath.c
index f616c1c..e234385 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -601,10 +601,15 @@
             r = lyht_insert(set->ht, &hnode, hash, NULL);
             assert(!r);
             (void)r;
-        }
-    } else if (set->ht) {
-        assert(node);
 
+            if (hnode.node == node) {
+                /* it was just added, do not add it twice */
+                node = NULL;
+            }
+        }
+    }
+
+    if (set->ht && node) {
         /* add the new node into hash table */
         hnode.node = node;
         hnode.type = type;