diff --git a/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java b/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
index 4efeeb6..b002eaf 100644
--- a/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
+++ b/src/main/java/de/ids_mannheim/korap/query/serialize/AqlTree.java
@@ -297,25 +297,31 @@
 				if (!getNodeCat(operandTree1.getChild(0)).equals("variableExpr")) {
 					ref1 = operandTree1.getChild(0).toStringTree(parser).substring(1);
 					operand1 = variableReferences.get(ref1);
-					if (nodeReferencesProcessed.get(ref1) < nodeReferencesTotal.get(ref1)-1) {
-						operand1 = wrapInClass(operand1);
-						group = wrapInFocus(group);
-						classCounter++;
-						nodeReferencesProcessed.put(ref1, nodeReferencesProcessed.get(ref1)+1);
+					if (nodeReferencesTotal.get(ref1) > 1) {
+						if (nodeReferencesProcessed.get(ref1) == 0) {
+							operand1 = wrapInClass(operand1);
+							group = wrapInFocus(group);
+							classCounter++;
+							nodeReferencesProcessed.put(ref1, nodeReferencesProcessed.get(ref1)+1);
+						} else if (nodeReferencesProcessed.get(ref1)>0) {
+							operand1 = null;
+						}
 					}
 				}
 				if (!getNodeCat(operandTree2.getChild(0)).equals("variableExpr")) {
 					ref2 = operandTree2.getChild(0).toStringTree(parser).substring(1);
 					operand2 = variableReferences.get(ref2);
-					if (nodeReferencesProcessed.get(ref2) < nodeReferencesTotal.get(ref2)-1) {
-						operand2 = wrapInClass(operand2);
-						group = wrapInFocus(group);
-						classCounter++;
-						nodeReferencesProcessed.put(ref2, nodeReferencesProcessed.get(ref2)+1);
+					if (nodeReferencesTotal.get(ref2) > 1) {
+						if (nodeReferencesProcessed.get(ref2)==0) {
+							operand2 = wrapInClass(operand2);
+							group = wrapInFocus(group);
+							classCounter++;
+							nodeReferencesProcessed.put(ref2, nodeReferencesProcessed.get(ref2)+1);
+						} else if (nodeReferencesProcessed.get(ref2)>0 && nodeReferencesTotal.get(ref2)>1) {
+							operand2 = null;
+						}
 					}
 				}
-				// XXX deal with multiple predications
-				
 				// Inject operands.
 				// -> Case distinction:
 				if (node.getChildCount()==3) {
@@ -327,8 +333,8 @@
 					// ... but things get a little more complicated here. The AST is of this form: (operand1 operator 1 operand2 operator2 operand3 operator3 ...)
 					// but we'll have to serialize it in a nested, binary way: (((operand1 operator1 operand2) operator2 operand3) operator3 ...)
 					// the following code will do just that:
-					// for the first operator, include both operands
 					if (i == 1) {
+						// for the first operator, include both operands
 						if (operand1 != null) operands.add(operand1);
 						if (operand2 != null) operands.add(wrapInClass(operand2));
 						classCounter++;
@@ -336,17 +342,18 @@
 						// (because this group will have to be an operand of a subsequent operator)
 						operandStack.push(group);
 					// for all subsequent operators, only take the 2nd operand (first was already added by previous operator)
-					// This is the last operator. Include 2nd operand and insert previously stored group at first position
-					} else if (i == node.getChildCount()-2) {
-						if (operand2 != null) operands.add(operand2);
-					// for all intermediate operators, include other previous groups and 2nd operand. Store this on the operandStack, too.
-					} else {
+					} else if (i < node.getChildCount()-2){
+						// for all intermediate operators, include other previous groups and 2nd operand. Store this on the operandStack, too.
 						if (operand2 != null) operands.add(wrapInClass(operand2));
 						classCounter++;
 						operands.add(0, operandStack.pop());
 						operandStack.push(group);
+					} else if (i == node.getChildCount()-2) {
+						// This is the last operator. Include 2nd operand only
+						if (operand2 != null) operands.add(operand2);
 					}
 				}
+				// Final step: decide what to do with the 'group' object, depending on whether all relations have been processed
 				if (i == node.getChildCount()-2 && relationCounter == totalRelationCount) {
 					putIntoSuperObject(group);
 					if (!operandStack.isEmpty()) {
