context CHANGE always return non-const module

Refs #1645
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 3c95a90..702563a 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -1473,7 +1473,7 @@
     }
 
     /* decide the latest revision */
-    latest = (struct lys_module *)ly_ctx_get_module_latest(ctx, mod->name);
+    latest = ly_ctx_get_module_latest(ctx, mod->name);
     if (latest) {
         if (mod->revision) {
             if (!latest->revision) {
@@ -1498,7 +1498,7 @@
     }
 
     /* check whether it is not already in the context in the same revision */
-    mod_dup = (struct lys_module *)ly_ctx_get_module(ctx, mod->name, mod->revision);
+    mod_dup = ly_ctx_get_module(ctx, mod->name, mod->revision);
     if (mod_dup) {
         /* nothing to do */
         LOGVRB("Module \"%s@%s\" is already present in the context.", mod_dup->name,