Minor changes after Poznan (with a broken test)
diff --git a/src/main/java/de/ids_mannheim/korap/KorapIndex.java b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
index 4ccc4d0..5082be9 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapIndex.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapIndex.java
@@ -61,7 +61,7 @@
 
 /*
   Todo: Use FieldCache!
-
+  TODO: Reuse the indexreader everywhere - it should be threadsafe!
 
   http://invertedindex.blogspot.co.il/2009/04/lucene-dociduid-mapping-and-payload.html
   see korap/search.java -> retrieveTokens
@@ -704,12 +704,10 @@
 		    kr.setBenchmarkSearchResults(t1, t2);
 		};
 
-		/*
-TEMPORARY:
+		// Can be disabled TEMPORARILY
 		while (spans.next()) {
 		    i++;
 		};
-		*/
 
 		for (KorapMatch km : atomicMatches) {
 		    km.processHighlight(pto);
diff --git a/src/main/java/de/ids_mannheim/korap/KorapQuery.java b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
index 0ee3895..12b34d3 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
@@ -56,7 +56,9 @@
 
     // http://fasterxml.github.io/jackson-databind/javadoc/2.2.0/com/fasterxml/jackson/databind/JsonNode.html
     // TODO: Exception messages are horrible!
-    // Todo: Use the shortcuts implemented in this class instead of the wrapper constructors
+    // TODO: Use the shortcuts implemented in this class instead of the wrapper constructors
+    // TODO: Check for isArray()
+    // TODO: Check for the number of operands before getting them
     public SpanQueryWrapperInterface fromJSON (JsonNode json) throws QueryException {
 
 	if (!json.has("@type")) {
@@ -140,6 +142,10 @@
 	    if (!json.has("operands"))
 		throw new QueryException("SpanSequenceQuery needs operands");
 
+	    JsonNode operands = json.get("operands");
+	    if (!operands.isArray() || operands.size() < 2)
+		throw new QueryException("SpanSequenceQuery needs operands");		
+		
 	    SpanSequenceQueryWrapper sseqqw = new SpanSequenceQueryWrapper(this.field);
 	    for (JsonNode operand : json.get("operands")) {
 		sseqqw.append(this.fromJSON(operand));
diff --git a/src/test/java/de/ids_mannheim/korap/filter/TestKorapCollection.java b/src/test/java/de/ids_mannheim/korap/filter/TestKorapCollection.java
index 54864aa..8b880f7 100644
--- a/src/test/java/de/ids_mannheim/korap/filter/TestKorapCollection.java
+++ b/src/test/java/de/ids_mannheim/korap/filter/TestKorapCollection.java
@@ -26,7 +26,7 @@
 	// Indexing test files
 	for (String i : new String[] {"00001", "00002", "00003", "00004", "00005", "00006", "02439"}) {
 	    FieldDocument fd = ki.addDocFile(
-	      getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
+					     getClass().getResource("/wiki/" + i + ".json.gz").getFile(), true
             );
 	};
 	ki.commit();
@@ -78,7 +78,7 @@
 	// System.err.println(kr.toJSON());
     };
 
-    @Ignore
+    @Test
     public void filterExampleAtomic () throws IOException {
 	
 	// That's exactly the same test class, but with multiple atomic indices
diff --git a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
index c62a71a..f8196a0 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
@@ -179,6 +179,14 @@
 	assertEquals(sqwi.toQuery().toString(), "tokens:base/p:foo");
     };
 
+    @Test
+    public void queryJSONBspClass () {
+	SpanQueryWrapperInterface sqwi = jsonQuery(getClass().getResource("/queries/bsp-class.json").getFile());
+
+	// within(<np>,[base=Mann])
+	assertEquals(sqwi.toQuery().toString(), "{0: spanNext(tokens:tt/p:ADJA, tokens:mate/p:NN)}");
+    };
+
 
     public static String getString (String path) {
 	StringBuilder contentBuilder = new StringBuilder();
diff --git a/src/test/resources/queries/bsp-class.json b/src/test/resources/queries/bsp-class.json
new file mode 100644
index 0000000..8125e6a
--- /dev/null
+++ b/src/test/resources/queries/bsp-class.json
@@ -0,0 +1 @@
+{"@context":{"korap":"http://korap.ids-mannheim.de/ns/query","@language":"de","operands":{"@id":"korap:operands","@container":"@list"},"relation":{"@id":"korap:relation","@type":"korap:relation#types"},"class":{"@id":"korap:class","@type":"xsd:integer"},"query":"korap:query","filter":"korap:filter","meta":"korap:meta"},"query":{"@type":"korap:group","class":"0","operands":[{"@type":"korap:sequence","operands":[{"@type":"korap:token","@value":{"@type":"korap:term","@value":"tt/p:ADJA","relation":"="}},{"@type":"korap:token","@value":{"@type":"korap:term","@value":"mate/p:NN","relation":"="}}]}]},"meta":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"WPD"}}],"startPage":1,"count":50,"context":{"left":["token",6],"right":["token",6]}}
diff --git a/src/test/resources/queries/bsp-startswith.json b/src/test/resources/queries/bsp-startswith.json
new file mode 100644
index 0000000..c986a5a
--- /dev/null
+++ b/src/test/resources/queries/bsp-startswith.json
@@ -0,0 +1 @@
+{"@context":{"korap":"http://korap.ids-mannheim.de/ns/query","@language":"de","operands":{"@id":"korap:operands","@container":"@list"},"relation":{"@id":"korap:relation","@type":"korap:relation#types"},"class":{"@id":"korap:class","@type":"xsd:integer"},"query":"korap:query","filter":"korap:filter","meta":"korap:meta"},"query":{"@type":"korap:group","relation":"position","position":"startswith","operands":[{"@type":"korap:element","@value":"s"},{"@type":"korap:sequence","operands":[{"@type":"korap:group","class":"0","operands":[{"@type":"korap:token","@value":{"@type":"korap:term","@value":"tt_p:ADJA","relation":"="}}]},{"@type":"korap:token","@value":{"@type":"korap:term","@value":"mate_p:NN","relation":"="}}]}]},"meta":[{"@type":"korap:meta-filter","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"A00"}},{"@type":"korap:meta-extend","@value":{"@type":"korap:term","@field":"korap:field#corpusID","@value":"A01"}}],"startPage":1,"count":50,"context":{"left":["token",6],"right":["token",6]}}
diff --git a/src/test/resources/queries/readme.txt b/src/test/resources/queries/readme.txt
index 5fa4709..f6f2584 100644
--- a/src/test/resources/queries/readme.txt
+++ b/src/test/resources/queries/readme.txt
@@ -1,4 +1,5 @@
 bsp1.json:   [base=foo]|([base=foo][base=bar])* meta author=Goethe&year=1815
+bsp1b.json:  [base=foo]|([base=foo][base=bar]) meta author=Goethe&year=1815
 bsp2.json:   ([base=foo]|[base=bar])[base=foobar]
 bsp3.json:   shrink({[base=Mann]})
 bsp4.json:   shrink({[base=foo]}[orth=bar])