diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
index 92ac1f3..643eb08 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/QuerySerializer.java
@@ -22,8 +22,13 @@
  */
 public class QuerySerializer {
 
+    // fixme: not used in any way!
+    @Deprecated
     static HashMap<String, Class<? extends AbstractQueryProcessor>> qlProcessorAssignment;
 
+
+
+
     static {
         qlProcessorAssignment = new HashMap<String, Class<? extends AbstractQueryProcessor>>();
         qlProcessorAssignment
@@ -174,11 +179,10 @@
             List warnings = (List) requestMap.get("warnings");
             List messages = (List) requestMap.get("messages");
             this.collection = mergeCollection(collection, this.collection);
-            if (this.collection != null && !this.collection.isEmpty())
-                requestMap.put("collection", this.collection);
+            requestMap.put("collection", this.collection);
             if (this.meta != null) {
-                meta.putAll(this.meta);
-                requestMap.put("meta", meta);
+                this.meta.putAll(meta);
+                requestMap.put("meta", this.meta);
             }
             if (this.errors != null && !this.errors.isEmpty()) {
                 errors.addAll(this.errors);
@@ -193,11 +197,29 @@
                 requestMap.put("messages", messages);
             }
 
-            return requestMap;
+            return cleanup(requestMap);
         }
         return new HashMap<>();
     }
 
+    private Map<String, Object> cleanup(Map<String, Object> requestMap) {
+        Iterator<Map.Entry<String, Object>> set = requestMap.entrySet()
+                .iterator();
+        while (set.hasNext()) {
+            Map.Entry<String, Object> entry = set.next();
+            if (entry.getValue() instanceof List && ((List) entry.getValue())
+                    .isEmpty())
+                set.remove();
+            else if (entry.getValue() instanceof Map && ((Map) entry.getValue())
+                    .isEmpty())
+                set.remove();
+            else if (entry.getValue() instanceof String && ((String) entry
+                    .getValue()).isEmpty())
+                set.remove();
+        }
+        return requestMap;
+    }
+
     private Map<String, Object> mergeCollection(Map<String, Object> collection1,
             Map<String, Object> collection2) {
         if (collection1 == null || collection1.isEmpty()) {
diff --git a/src/test/java/de/ids_mannheim/korap/query/serialize/EmptyResultsTest.java b/src/test/java/de/ids_mannheim/korap/query/serialize/EmptyResultsTest.java
new file mode 100644
index 0000000..fd2e64f
--- /dev/null
+++ b/src/test/java/de/ids_mannheim/korap/query/serialize/EmptyResultsTest.java
@@ -0,0 +1,44 @@
+package de.ids_mannheim.korap.query.serialize;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * @author hanl
+ * @date 02/07/2015
+ */
+public class EmptyResultsTest {
+
+    private static ObjectMapper mapper = new ObjectMapper();
+
+    @Test
+    public void testEmptyQueryObject() {
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("prox/unit=word/distance<=5", "cql");
+        JsonNode node = mapper.valueToTree(s.build());
+        Assert.assertEquals(node.has("query"), false);
+        Assert.assertEquals(node.has("collection"), false);
+    }
+
+    @Test
+    public void testEmptyCollectionObject() {
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[base=Wort]", "poliqarp");
+
+        JsonNode node = mapper.valueToTree(s.build());
+        Assert.assertEquals(node.has("query"), true);
+        Assert.assertEquals(node.has("collection"), false);
+    }
+
+    @Test
+    public void testEmptyMetaObject() {
+        QuerySerializer s = new QuerySerializer();
+        s.setQuery("[base=Wort]", "poliqarp");
+
+        JsonNode node = mapper.valueToTree(s.build());
+        Assert.assertEquals(node.has("meta"), false);
+    }
+
+}
