schema helpers BUGFIX action and notification node when access
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 79d789c..188744b 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -254,7 +254,7 @@
 {
     struct lyd_meta *meta2, *prev_meta = NULL;
 
-    if (!(node->schema->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)) && node->schema->when) {
+    if (lysc_has_when(node->schema)) {
         if (!(options & LYD_PARSE_ONLY)) {
             /* remember we need to evaluate this node's when */
             LY_CHECK_RET(ly_set_add(when_check, node, 1, NULL), );