bugfix (quantification in position)
diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
index 2d650a9..57b5d98 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/PoliqarpPlusTree.java
@@ -149,12 +149,7 @@
 				query = query.replaceAll(" ", "");
 				process(query);
 			} else {
-				try {
-					throw new QueryException("Error handling query.");
-				} catch (QueryException e1) {
-					e1.printStackTrace();
-					System.exit(1);
-				}
+				throw new QueryException("Error handling query.");
 			}
 		}
 		System.out.println(">>> "+requestMap.get("query")+" <<<");
@@ -261,8 +256,7 @@
 						Integer min = Integer.parseInt(minmax[0]);
 						Integer max = Integer.parseInt(minmax[1]);
 						sequence.put("@type", "korap:group");
-						sequence.put("operation", "operation:"+"sequence");
-//						sequence.put("operation", "operation:"+"distance");
+						sequence.put("operation", "operation:sequence");
 						sequence.put("inOrder", true);
 						ArrayList<Object> constraint = new ArrayList<Object>(); 
 						sequence.put("distances", constraint);
@@ -305,6 +299,8 @@
 					// else, it's a group (with shrink()/spanclass/align... as child)
 					} else {
 						sequence.put("@type", "korap:group");
+//						objectStack.push(sequence);
+//						stackedObjects++;
 					}
 				}
 				// Step II: decide where to put this element 
@@ -334,12 +330,22 @@
 								stackedObjects++;
 							} else {
 								// if not first child, add to previously created parent sequence
-								ArrayList<Object> topSequenceOperands = (ArrayList<Object>) objectStack.get(1).get("operands");
+								ArrayList<Object> topSequenceOperands;
+								try {
+									topSequenceOperands = (ArrayList<Object>) objectStack.get(1).get("operands");
+								} catch (IndexOutOfBoundsException e) {
+									// Normally, the current element has been added to the object stack, so the try-block works fine.
+									// In some cases however, the element is not added (see ultimate else-block in Step I), and we need a 
+									// fallback to the first element in the object stack.
+									topSequenceOperands = (ArrayList<Object>) objectStack.get(0).get("operands");
+								}
+								
 								topSequenceOperands.add(sequence);
 							}
 						}
 					} else if (!objectStack.isEmpty()){
 						// embed in super sequence
+						System.out.println(objectStack);
 						ArrayList<Object> topSequenceOperands = (ArrayList<Object>) objectStack.get(1).get("operands");
 						topSequenceOperands.add(sequence);
 					}
@@ -876,7 +882,12 @@
 		} else {
 			repetition = repetition.substring(1, repetition.length()-1); // remove braces
 			String[] splitted = repetition.split(",");
-			return new int[] {Integer.parseInt(splitted[0]), Integer.parseInt(splitted[1])};
+			if (splitted.length==2) {
+				return new int[] {Integer.parseInt(splitted[0]), Integer.parseInt(splitted[1])};
+			} else {
+				return new int[] {Integer.parseInt(splitted[0]), Integer.parseInt(splitted[0])};
+			}
+			
 		}
 	}
 
@@ -984,13 +995,17 @@
 		
 		String[] queries = new String[] {
 				"shrink(1|2:{1:[base=der]}{2:[base=Mann]})",
-//				"[base=foo] meta (author=name&year=2000)",
-//				"[base=foo] meta year=2000",
 				"{[base=Mann]}",
 				"shrink(1:[orth=Der]{1:[orth=Mann][orth=geht]})",
 				"[base=Mann/i]",
 				"[cnx/base=pos:n]",
-				"<cnx/c=np>"
+				"<cnx/c=np>",
+				"contains(<cnx/c=np>, [mate/pos=NE])",
+				"matches(<A>,[pos=N]*)",
+				"matches(<A>,[pos=N]{4})",
+				"([base=bar][base=foo])*"
+//				"matches(<A>,[pos=N])",
+//				"[pos=V]{3}"
 		};
 		PoliqarpPlusTree.debug=true;
 		for (String q : queries) {
diff --git a/src/test/java/PoliqarpPlusTreeTest.java b/src/test/java/PoliqarpPlusTreeTest.java
index bb97c45..b08a315 100644
--- a/src/test/java/PoliqarpPlusTreeTest.java
+++ b/src/test/java/PoliqarpPlusTreeTest.java
@@ -185,9 +185,9 @@
 		// [base=Mann&(cas=N|cas=A)]
 		String cof1 = 
 			"{@type=korap:token, wrap=" +
-				"{@type=korap:termGroup, relation=and, operands=[" +
+				"{@type=korap:termGroup, relation=relation:and, operands=[" +
 					"{@type=korap:term, key=Mann, layer=lemma, match=match:eq}," +
-					"{@type=korap:termGroup, relation=or, operands=[" +
+					"{@type=korap:termGroup, relation=relation:or, operands=[" +
 						"{@type=korap:term, key=N, layer=cas, match=match:eq}," +
 						"{@type=korap:term, key=A, layer=cas, match=match:eq}" +
 					"]}" +
@@ -206,7 +206,7 @@
 		// [base=Mann&cas=N&gen=m]
 		String cof2 = 
 			"{@type=korap:token, wrap=" +
-				"{@type=korap:termGroup, relation=and, operands=[" +
+				"{@type=korap:termGroup, relation=relation:and, operands=[" +
 					"{@type=korap:term, key=Mann, layer=lemma, match=match:eq}," +
 					"{@type=korap:term, key=N, layer=cas, match=match:eq}," +
 					"{@type=korap:term, key=m, layer=gen, match=match:eq}" +
@@ -351,6 +351,14 @@
 		ppt = new PoliqarpPlusTree("[base=foo]{2,5}");
 		map = ppt.getRequestMap().get("query").toString();
 		assertEquals(occ11.replaceAll(" ", ""), map.replaceAll(" ", ""));
+		
+		// [base=foo]{2}
+		String occ12 = "{@type=korap:group, operands=[" +
+					     "{@type=korap:token, wrap={@type=korap:term, key=foo, layer=lemma, match=match:eq}}" +
+					  "], operation=operation:repetition, min=2, max=2}"; 
+		ppt = new PoliqarpPlusTree("[base=foo]{2}");
+		map = ppt.getRequestMap().get("query").toString();
+		assertEquals(occ12.replaceAll(" ", ""), map.replaceAll(" ", ""));
 	}
 	
 	@Test