xpath BUGFIX full accessible tree for output xpath search
diff --git a/src/xpath.c b/src/xpath.c
index bee8e2c..da27681 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -9600,7 +9600,7 @@
         /* schema */
         for (op = ctx_scnode; op && !(op->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)); op = op->parent) {}
 
-        if (op || (options & LYXP_SCNODE)) {
+        if (op || !(options & LYXP_SCNODE_SCHEMA)) {
             /* general root that can access everything */
             return LYXP_NODE_ROOT;
         } else if (!ctx_scnode || (ctx_scnode->flags & LYS_CONFIG_W)) {