tree data helpers BUGFIX move iterator

Refs #1726
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index 97db00f..714b1fd 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -592,6 +592,9 @@
             /* get schema node */
             schema = lys_find_child(schema, mod ? mod : schema->module, LYD_NAME(iter), 0, 0, 0);
         }
+
+        /* remember to move to the descendant */
+        prev_iter = iter;
     } while (schema && (iter != node));
 
     return schema;