Ignore foundry for orth layer
diff --git a/CHANGES b/CHANGES
index fc83369..2eddfc4 100644
--- a/CHANGES
+++ b/CHANGES
@@ -7,6 +7,7 @@
 	  be deserialized (diewald)
 	- [bugfix] Queries with regular expressions in spanNext() are now
 	  correctly rewritten (diewald)
+	- [bugfix] Ignore foundry for orth layer (diewald)
 
 0.47 2014-11-05
         - [feature] Support new index format with more metadata (diewald)
diff --git a/src/main/java/de/ids_mannheim/korap/KorapQuery.java b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
index a34c46f..2cf0832 100644
--- a/src/main/java/de/ids_mannheim/korap/KorapQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/KorapQuery.java
@@ -631,6 +631,10 @@
 	    if (isCaseInsensitive && isTerm && layer.equals("s"))
 		layer = "i";
 
+	    // Ignore foundry for orth layer
+	    if (layer.equals("s"))
+		value.setLength(0);
+
 	    value.append(layer).append(':');
 	};
 
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 41cac0f..8f4dd0e 100644
--- a/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
+++ b/src/test/java/de/ids_mannheim/korap/query/TestKorapQueryJSON.java
@@ -285,6 +285,14 @@
 	assertEquals(sqwi.toQuery().toString(), "shrink(129: spanElementDistance({129: tokens:s:Namen}, {129: tokens:s:Leben}, [(base/s:s[0:1], notOrdered, notExcluded)]))");
     };
 
+    @Test
+    public void queryJSONfoundryForOrthBug () throws QueryException {
+	SpanQueryWrapper sqwi = jsonQuery(getClass().getResource("/queries/bugs/foundry_for_orth.jsonld").getFile());
+
+	// opennlp/orth:Baum
+	assertEquals(sqwi.toQuery().toString(), "tokens:s:Baum");
+    };
+
 
 
     public static String getString (String path) {
diff --git a/src/test/resources/queries/bugs/foundry_for_orth.jsonld b/src/test/resources/queries/bugs/foundry_for_orth.jsonld
new file mode 100644
index 0000000..bac4ce6
--- /dev/null
+++ b/src/test/resources/queries/bugs/foundry_for_orth.jsonld
@@ -0,0 +1,13 @@
+{
+  "@context":"http://ids-mannheim.de/ns/KorAP/json-ld/v0.2/context.jsonld",
+  "query":{
+    "@type" : "korap:token",
+    "wrap" : {
+      "@type" : "korap:term",
+      "foundry" : "opennlp",
+      "key" : "Baum",
+      "layer" : "orth",
+      "match" : "match:eq"
+    }
+  }
+}