diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/JsonGenerator.java b/src/main/java/de/ids_mannheim/korap/query/serialize/JsonGenerator.java
index 243a4d7..86f86f5 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/JsonGenerator.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/JsonGenerator.java
@@ -125,9 +125,11 @@
             throw new IllegalArgumentException(ql + " is not a supported query language!");
         }
         Map<String, Object> requestMap = ast.getRequestMap();
+        MetaQuery metaQuery = new MetaQuery();
+        metaQuery.addResources(parents);
+
         try {
-            List<Map> meta_re = serializer.serializeResources(parents);
-            requestMap.put("meta", meta_re);
+            requestMap.put("meta", metaQuery.raw());
             requestMap = serializer.addParameters(requestMap, page, num,
                     cli, cri, cls, crs);
             String res = mapper.writeValueAsString(requestMap);
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuery.java b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuery.java
index 3547d82..452d3c2 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/MetaQuery.java
@@ -35,24 +35,25 @@
         this.track = ArrayListMultimap.create();
     }
 
-    public MetaQuery addResource(String query) throws IOException {
-        JsonParser jp = factory.createParser(query);
-        JsonNode m = jp.readValueAsTree();
-        for (JsonNode n : m)
-            this.rq.add(serialzer.treeToValue(n, Map.class));
-        return this;
-    }
-
-    public MetaQuery addResources(List<String> queries) throws IOException {
-        for (String query : queries) {
+    public MetaQuery addResource(String query) {
+        try {
             JsonParser jp = factory.createParser(query);
             JsonNode m = jp.readValueAsTree();
             for (JsonNode n : m)
                 this.rq.add(serialzer.treeToValue(n, Map.class));
+        } catch (IOException e) {
+            e.printStackTrace();
+            throw new IllegalArgumentException("Conversion went wrong!");
         }
         return this;
     }
 
+    public MetaQuery addResources(List<String> queries) {
+        for (String query : queries)
+            addResource(query);
+        return this;
+    }
+
     public MetaQuery addMetaFilter(Map<String, String> queries) {
         //single is redundant!
         boolean single = true;
@@ -228,11 +229,12 @@
     public void clear() {
         this.rq.clear();
         this.mfil.clear();
+        this.track.clear();
     }
 
     @Deprecated
     //todo: ordering irrelevant
-    private List<Map> join() {
+    private List<Map> joinO() {
         List<Map> cursor = new ArrayList<>(this.rq);
         List<Map> copy = new ArrayList<>();
         if (!this.mext.isEmpty()) {
@@ -250,16 +252,26 @@
         return cursor;
     }
 
-    private List<Map> join2() {
+    private List<Map> join() {
         List<Map> cursor = new ArrayList<>(this.rq);
         cursor.addAll(this.mfil);
         cursor.addAll(this.mext);
         return cursor;
     }
 
+    private List<Map> getMetaOnly() {
+        List<Map> cursor = new ArrayList<>(this.mfil);
+        cursor.addAll(this.mext);
+        return cursor;
+    }
+
+    /**
+     * returns the meta query only and does not contain parent dependencies
+     * @return
+     */
     public String stringify() {
         try {
-            return serialzer.writeValueAsString(join2());
+            return serialzer.writeValueAsString(getMetaOnly());
         } catch (JsonProcessingException e) {
             e.printStackTrace();
             return "";
@@ -267,12 +279,27 @@
     }
 
     public JsonNode jsonify() {
-        return serialzer.valueToTree(join2());
+        return serialzer.valueToTree(join());
     }
 
+    /**
+     * returns the List<Map> that contains all the meta queries and resource queries
+     * added to the meta query container
+     * @return
+     */
+    public List<Map> raw() {
+        return join();
+    }
+
+    /**
+     * returns a JSON String representation that contains all information
+     * (meta query and resource meta queries alike) in a root meta JSON node
+     *
+     * @return
+     */
     public String toMeta() {
         Map meta = new LinkedHashMap();
-        meta.put("meta", join2());
+        meta.put("meta", join());
 
         try {
             return serialzer.writeValueAsString(meta);
