data tree MAINTENANCE use macro
diff --git a/src/tree_data.c b/src/tree_data.c
index b2fe0b0..c864d7b 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -3818,7 +3818,7 @@
 
     LY_CHECK_ARG_RET(NULL, node, NULL);
     if (buffer) {
-        LY_CHECK_ARG_RET(node->schema->module->ctx, buflen > 1, NULL);
+        LY_CHECK_ARG_RET(LYD_CTX(node), buflen > 1, NULL);
         is_static = 1;
     } else {
         buflen = 0;