tree data UPDATE updating NP cont dflt flag
diff --git a/src/parser_common.c b/src/parser_common.c
index cd32300..cf509ca 100644
--- a/src/parser_common.c
+++ b/src/parser_common.c
@@ -266,10 +266,13 @@
             /* delete the metadata */
             if (prev_meta) {
                 prev_meta->next = meta2->next;
-            } else {
+            } else if (meta != &node->meta) {
                 *meta = (*meta)->next;
             }
             lyd_free_meta_single(meta2);
+
+            /* update dflt flag for all parent NP containers */
+            lyd_cont_set_dflt(lyd_parent(node));
             break;
         }