xpath BUGFIX start node proper merge
diff --git a/src/xpath.c b/src/xpath.c
index 35c29f4..10d0cdf 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -1116,7 +1116,12 @@
             }
         }
 
-        if (j == orig_used) {
+        if (j < orig_used) {
+            /* node is there, but update its status if needed */
+            if (set1->val.scnodes[j].in_ctx == LYXP_SET_SCNODE_START_USED) {
+                set1->val.scnodes[j].in_ctx = set2->val.scnodes[i].in_ctx;
+            }
+        } else {
             memcpy(&set1->val.scnodes[set1->used], &set2->val.scnodes[i], sizeof *set2->val.scnodes);
             ++set1->used;
         }