diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java b/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
index 09c68c3..b3e1d45 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/Cosmas2QueryProcessor.java
@@ -477,20 +477,18 @@
         if (positionOptions.containsKey("exclude")) {
             posgroup.put("exclude", positionOptions.get("exclude"));
         }
-        if (positionOptions.containsKey("grouping")) {
-            posgroup.put("grouping", positionOptions.get("grouping"));
-        }
         objectStack.push(posgroup);
         // mark this an inverted operands object
         invertedOperandsLists.push((ArrayList<Object>) posgroup.get("operands"));
         stackedObjects++;
-        // Step II: wrap in reference and decide where to put
+        // Step II: wrap in focus and decide where to put
         ArrayList<String> check = 
                 (ArrayList<String>) positionOptions.get("classRefCheck");
         Integer[] classIn = 
                 new Integer[] { 128 + classCounter - 2, 128 + classCounter - 1 };
         LinkedHashMap<String, Object> classRefCheck = 
-                KoralObjectGenerator.makeClassRefCheck(check, classIn, 128 + classCounter);
+                KoralObjectGenerator.makeClassRefCheck(check, classIn,
+                        128 + classCounter);
         ((ArrayList<Object>) classRefCheck.get("operands")).add(posgroup);
         LinkedHashMap<String, Object> focusGroup = null;
         if ((boolean) positionOptions.get("matchall") == true) {
@@ -501,6 +499,17 @@
             focusGroup = KoralObjectGenerator.wrapInReference(classRefCheck,
                     128 + classCounter - 1);
         }
+        System.err.println(positionOptions);
+        // wrap in 'merge' operation if grouping option is set
+        if (positionOptions.containsKey("grouping")) {
+            if (positionOptions.get("grouping").equals(true)) {
+                LinkedHashMap<String, Object> mergeOperation = 
+                        KoralObjectGenerator.makeGroup("merge");
+                ArrayList<Object> mergeOperands = (ArrayList<Object>) mergeOperation.get("operands");
+                mergeOperands.add(focusGroup);
+                focusGroup = mergeOperation;
+            }
+        }
         putIntoSuperObject(focusGroup, 1);
     }
 
@@ -1128,14 +1137,17 @@
         }
 
         if (negatePosition) {
-            posOptions.put("exclude", "true");
+            posOptions.put("exclude", true);
         }
 
+        boolean grouping = false;
         if (groupnode != null) {
-            String grouping = groupnode.getChild(0).toStringTree()
-                    .equals("max") ? "true" : "false";
-            posOptions.put("grouping", grouping);
-        }
+            if (groupnode.getChild(0).toStringTree().equalsIgnoreCase("max")) {
+                grouping = true;
+            }
+        } 
+        posOptions.put("grouping", grouping);
+        
         return posOptions;
     }
 
@@ -1220,12 +1232,15 @@
         if (negatePosition) {
             posOptions.put("exclude", "true");
         }
-
+        
+        boolean grouping = false;
         if (groupnode != null) {
-            String grouping = groupnode.getChild(0).toStringTree()
-                    .equals("max") ? "true" : "false";
-            posOptions.put("grouping", grouping);
-        }
+            if (groupnode.getChild(0).toStringTree().equalsIgnoreCase("max")) {
+                grouping = true;
+            }
+        } 
+        posOptions.put("grouping", grouping);
+        
         return posOptions;
     }
 
diff --git a/src/test/java/Cosmas2QueryProcessorTest.java b/src/test/java/Cosmas2QueryProcessorTest.java
index a65ec95..e9c1815 100644
--- a/src/test/java/Cosmas2QueryProcessorTest.java
+++ b/src/test/java/Cosmas2QueryProcessorTest.java
@@ -621,6 +621,15 @@
 		assertEquals("classRefCheck:equals",		res.at("/query/operands/0/classRefCheck/0").asText());
 		assertEquals("frames:matches",				res.at("/query/operands/0/operands/0/frames/0").asText());
 		assertEquals(true,							res.at("/query/operands/0/operands/0/exclude").asBoolean());
+		
+		query = "wegen #IN(FE,ALL,%,MAX) <s>";
+        qs.setQuery(query, "cosmas2");
+        res = mapper.readTree(qs.toJSON());
+        assertEquals("operation:merge",             res.at("/query/operation").asText());
+        assertEquals(true,                          res.at("/query/operands/0/reset").asBoolean());
+        assertEquals("classRefCheck:equals",        res.at("/query/operands/0/operands/0/classRefCheck/0").asText());
+        assertEquals("frames:matches",              res.at("/query/operands/0/operands/0/operands/0/frames/0").asText());
+        assertEquals(true,                          res.at("/query/operands/0/operands/0/operands/0/exclude").asBoolean());
 	}
 
 	@Test
