in BUGFIX keep first meta instance pointer

Just connect new instances after it, do
not move the pointer itself.
diff --git a/src/in.c b/src/in.c
index d4ba129..0a69853 100644
--- a/src/in.c
+++ b/src/in.c
@@ -431,6 +431,12 @@
         void *prefix_data, uint32_t hints)
 {
     ly_bool incomplete;
+    struct lyd_meta *first = NULL;
+
+    if (meta && *meta) {
+        /* remember the first metadata */
+        first = *meta;
+    }
 
     LY_CHECK_RET(lyd_create_meta(parent, meta, mod, name, name_len, value, value_len, dynamic, format, prefix_data,
             hints, &incomplete));
@@ -438,5 +444,11 @@
     if (incomplete && !(lydctx->parse_options & LYD_PARSE_ONLY)) {
         LY_CHECK_RET(ly_set_add(&lydctx->unres_meta_type, *meta, 1, NULL));
     }
+
+    if (first) {
+        /* always return the first metadata */
+        *meta = first;
+    }
+
     return LY_SUCCESS;
 }
diff --git a/src/parser_internal.h b/src/parser_internal.h
index 500068a..4b1b26a 100644
--- a/src/parser_internal.h
+++ b/src/parser_internal.h
@@ -287,7 +287,18 @@
  * @brief Wrapper around ::lyd_create_meta() for data parsers.
  *
  * @param[in] lydctx Data parser context.
+ * @param[in] parent Parent of the created meta. Must be set if @p meta is NULL.
+ * @param[in,out] meta First existing meta to connect to or empty pointer to set. Must be set if @p parent is NULL.
+ * @param[in] mod Module of the created metadata.
+ * @param[in] name Metadata name.
+ * @param[in] name_len Length of @p name.
+ * @param[in] value Metadata value.
+ * @param[in] value_len Length of @p value.
+ * @param[in,out] dynamic Whether the @p value is dynamically allocated, is adjusted once the value is assigned.
+ * @param[in] format Prefix format.
+ * @param[in] prefix_data Prefix format data (see ::ly_resolve_prefix()).
  * @param[in] hints [Value hint](@ref lydvalhints) from the parser regarding the value type.
+ * @return LY_ERR value.
  */
 LY_ERR lyd_parser_create_meta(struct lyd_ctx *lydctx, struct lyd_node *parent, struct lyd_meta **meta,
         const struct lys_module *mod, const char *name, size_t name_len, const char *value,