diff --git a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
index 8594285..eec413c 100644
--- a/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
+++ b/src/test/java/de/ids_mannheim/korap/index/TestElementDistanceIndex.java
@@ -40,13 +40,14 @@
     private FieldDocument createFieldDoc0 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-0");
-        fd.addTV("tokens", "text",
+        fd.addTV("tokens", "bbcbbb",
                 "[(0-1)s:b|s:c|_1$<i>0<i>1|<>:s$<b>64<i>0<i>1<i>1<b>0]"
                         + "[(1-2)s:b|_2$<i>1<i>2]"
                         + "[(2-3)s:c|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>3<b>0]"
                         + "[(3-4)s:b|_4$<i>3<i>4|<>:s$<b>64<i>3<i>4<i>4<b>0]"
                         + "[(4-5)s:b|_5$<i>4<i>5|<>:s$<b>64<i>4<i>5<i>5<b>0]"
-                        + "[(5-6)s:b|_6$<i>5<i>6]" + "[(6-7)s:c|_7$<i>6<i>7]");
+                        + "[(5-6)s:b|_6$<i>5<i>6]"
+                        + "[(6-7)s:c|_7$<i>6<i>7|<>:s$<b>64<i>6<i>7<i>7<b>0]");
         return fd;
     }
 
@@ -59,7 +60,7 @@
                         + "[(1-2)s:c|s:b|_2$<i>1<i>2|<>:s$<b>64<i>1<i>2<i>2<b>0]"
                         + "[(2-3)s:e|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>3<b>0]"
                         + "[(3-4)s:b|_4$<i>3<i>4|<>:s$<b>64<i>3<i>4<i>4<b>0]"
-                        + "[(4-5)s:d|_5$<i>4<i>5|<>:s$<b>64<i>4<i>5<i>5<b>0]"
+                        + "[(4-5)s:c|_5$<i>4<i>5|<>:s$<b>64<i>4<i>5<i>5<b>0]"
                         + "[(5-6)s:c|_6$<i>5<i>6|<>:s$<b>64<i>5<i>6<i>6<b>0]");
         return fd;
     }
@@ -68,7 +69,7 @@
     private FieldDocument createFieldDoc2 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-2");
-        fd.addTV("tokens", "text",
+        fd.addTV("tokens", "bbbddd",
                 "[(0-1)s:b|_1$<i>0<i>1|<>:p$<b>64<i>0<i>2<i>1<b>0]"
                         + "[(1-2)s:b|_2$<i>1<i>2]"
                         + "[(2-3)s:b|_3$<i>2<i>3|<>:p$<b>64<i>2<i>3<i>3<b>0]"
@@ -82,7 +83,7 @@
     private FieldDocument createFieldDoc3 () {
         FieldDocument fd = new FieldDocument();
         fd.addString("ID", "doc-3");
-        fd.addTV("tokens", "text",
+        fd.addTV("tokens", "bdbcdd",
                 "[(0-1)s:b|_1$<i>0<i>1|<>:s$<b>64<i>0<i>2<i>1<b>0]"
                         + "[(1-2)s:d|_2$<i>1<i>2]"
                         + "[(2-3)s:b|_3$<i>2<i>3|<>:s$<b>64<i>2<i>3<i>3<b>0]"
@@ -92,6 +93,7 @@
         return fd;
     }
 
+
     public SpanQuery createQuery (String elementType, String x, String y,
             int min, int max, boolean isOrdered) {
 
@@ -110,22 +112,26 @@
      */
     @Test
     public void testCase1 () throws IOException {
-        //System.out.println("testCase1");
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.addDoc(createFieldDoc1());
+        ki.addDoc(createFieldDoc3());
         ki.commit();
 
         SpanQuery sq;
-        sq = createQuery("s", "s:b", "s:c", 0, 2, true);
+        sq = createQuery("s", "s:b", "s:c", 1, 1, true);
 
         kr = ki.search(sq, (short) 10);
 
-        assertEquals(kr.getTotalResults(), 4);
+        assertEquals(4, kr.getTotalResults());
         assertEquals(0, kr.getMatch(0).startPos);
-        assertEquals(1, kr.getMatch(0).endPos);
-        assertEquals(0, kr.getMatch(1).startPos);
-        assertEquals(3, kr.getMatch(1).endPos);
+        assertEquals(3, kr.getMatch(0).endPos);
+        assertEquals(4, kr.getMatch(1).startPos);
+        assertEquals(7, kr.getMatch(1).endPos);
+        assertEquals(3, kr.getMatch(2).startPos);
+        assertEquals(5, kr.getMatch(2).endPos);
+        assertEquals(2, kr.getMatch(3).startPos);
+        assertEquals(4, kr.getMatch(3).endPos);
     }
 
 
@@ -134,7 +140,6 @@
      */
     @Test
     public void testCase2 () throws IOException {
-        //System.out.println("testCase2");
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.addDoc(createFieldDoc1());
@@ -156,7 +161,6 @@
     /** Skip to */
     @Test
     public void testCase3 () throws IOException {
-        //System.out.println("testCase3");
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.addDoc(createFieldDoc1());
@@ -171,7 +175,7 @@
 
         kr = ki.search(sq, (short) 10);
 
-        assertEquals(kr.getTotalResults(), 1);
+        assertEquals(1, kr.getTotalResults());
         assertEquals(2, kr.getMatch(0).getLocalDocID());
         assertEquals(2, kr.getMatch(0).startPos);
         assertEquals(5, kr.getMatch(0).endPos);
@@ -182,7 +186,6 @@
     /** Same tokens in different elements */
     @Test
     public void testCase4 () throws IOException {
-        //System.out.println("testCase4");
         ki = new KrillIndex();
         ki.addDoc(createFieldDoc0());
         ki.commit();
@@ -203,7 +206,6 @@
     /** Test query from json */
     @Test
     public void testCase5 () throws Exception {
-        //System.out.println("testCase4");
         ki = new KrillIndex();
         ki.addDoc(getClass().getResourceAsStream("/wiki/00001.json.gz"), true);
         ki.commit();
@@ -252,6 +254,7 @@
         assertEquals("[[ec]]ebdc", kr.getMatch(0).getSnippetBrackets());
     }
 
+
     public static String getString (String path) {
         StringBuilder contentBuilder = new StringBuilder();
         try {
