data tree REFACTOR formatting
diff --git a/src/tree_data.c b/src/tree_data.c
index a6fb292..3dbbe17 100644
--- a/src/tree_data.c
+++ b/src/tree_data.c
@@ -2822,6 +2822,7 @@
 {
     LY_ERR ret = LY_SUCCESS;
     struct lysc_ext_instance *ant = NULL;
+    const struct lysc_type **ant_type;
     struct lyd_meta *mt, *last;
     LY_ARRAY_COUNT_TYPE u;
 
@@ -2849,8 +2850,9 @@
     LY_CHECK_ERR_GOTO(!mt, LOGMEM(mod->ctx); ret = LY_EMEM, cleanup);
     mt->parent = parent;
     mt->annotation = ant;
-    ret = lyd_value_store(mod->ctx, &mt->value,  *(const struct lysc_type **)ant->substmts[ANNOTATION_SUBSTMT_TYPE].storage,
-            value, value_len, dynamic, format, prefix_data, hints, parent ? parent->schema : NULL, incomplete);
+    ant_type = ant->substmts[ANNOTATION_SUBSTMT_TYPE].storage;
+    ret = lyd_value_store(mod->ctx, &mt->value, *ant_type, value, value_len, dynamic, format, prefix_data, hints,
+            parent ? parent->schema : NULL, incomplete);
     LY_CHECK_ERR_GOTO(ret, free(mt), cleanup);
     ret = lydict_insert(mod->ctx, name, name_len, &mt->name);
     LY_CHECK_ERR_GOTO(ret, free(mt), cleanup);