diff --git a/entity/Organisation_entity/Organisation_entity.aod b/entity/Organisation_entity/Organisation_entity.aod
index d4baac32bb99ce9c499697c327863886af9b9b2f..8ae5e1fe3a0fa3a207146819401f853ba9f99e01 100644
--- a/entity/Organisation_entity/Organisation_entity.aod
+++ b/entity/Organisation_entity/Organisation_entity.aod
@@ -1357,16 +1357,6 @@
       </affectedTables>
       <affectedIds>%aditoprj%/entity/Organisation_entity/recordcontainers/index/affectedIds.js</affectedIds>
       <indexFieldMappings>
-        <indexRecordFieldMapping>
-          <name>#LOCATION</name>
-          <indexFieldType>LOCATION</indexFieldType>
-          <additionalFieldNameAliases>
-            <element>location</element>
-          </additionalFieldNameAliases>
-          <isGlobalSearchField v="false" />
-          <isFilterable v="false" />
-          <isLookupFilter v="false" />
-        </indexRecordFieldMapping>
         <indexRecordFieldMapping>
           <name>NAME.value</name>
           <indexFieldType>PROPER_NAME</indexFieldType>
diff --git a/entity/Organisation_entity/recordcontainers/index/query.js b/entity/Organisation_entity/recordcontainers/index/query.js
index 10ff797d42ebe36b5e09926d0cdfcc8ca5d1fbd1..075671c143a8bc403bfeab5e3635d4f8d2fb531d 100644
--- a/entity/Organisation_entity/recordcontainers/index/query.js
+++ b/entity/Organisation_entity/recordcontainers/index/query.js
@@ -46,9 +46,7 @@ var querySelect = newSelect("CONTACT.CONTACTID "
                     .leftJoin("COMMUNICATION", "PHONE.CONTACT_ID = CONTACT.CONTACTID and PHONE.MEDIUM_ID in ('" + CommMediumPhoneIds.join("', '") + "')", "PHONE")//TODO: refactor to new SqlBuilder
                     .where("CONTACT.STATUS", $KeywordRegistry.contactStatus$inactive(), SqlBuilder.NOT_EQUAL())
 
-if (vars.exists("$local.idvalue") && vars.get("$local.idvalue") && vars.get("$local.idvalue").length > 0) 
-{
-    querySelect.where("CONTACT.CONTACTID", vars.get("$local.idvalue"), SqlBuilder.IN());
-}
+if (vars.exists("$local.idvalue"))
+    querySelect.whereIfSet("CONTACT.CONTACTID", "$local.idvalue");
 
 result.string(querySelect.toString());
diff --git a/entity/Person_entity/recordcontainers/index/query.js b/entity/Person_entity/recordcontainers/index/query.js
index efe2af2c2e996938edd2da2a322498bde9c87b0c..e72a0822ec400959bd5f36a8263c54141618b894 100644
--- a/entity/Person_entity/recordcontainers/index/query.js
+++ b/entity/Person_entity/recordcontainers/index/query.js
@@ -42,7 +42,6 @@ var querySelect = newSelect("CONTACT.CONTACTID "
                         )
                     .from("PERSON")
                     .join("CONTACT", "CONTACT.PERSON_ID = PERSON.PERSONID")
-                    .and("CONTACT.STATUS", $KeywordRegistry.contactStatus$inactive(), SqlBuilder.NOT_EQUAL())
                     .join("ORGANISATION", "CONTACT.ORGANISATION_ID = ORGANISATION.ORGANISATIONID")
                     .leftJoin("ADDRESS", "defaultAddress.ADDRESSID = CONTACT.ADDRESS_ID", "defaultAddress")
                     .leftJoin("ADDRESS", "ADDRESS.CONTACT_ID = CONTACT.CONTACTID")
@@ -51,11 +50,7 @@ var querySelect = newSelect("CONTACT.CONTACTID "
                     .where("CONTACT.STATUS", $KeywordRegistry.contactStatus$inactive(), SqlBuilder.NOT_EQUAL())
                     .orderBy("CONTACT.CONTACTID");
 
-if (vars.exists("$local.idvalue")) 
-{
-    affectedIds = vars.get("$local.idvalue");
-    querySelect.whereIfSet("CONTACT.CONTACTID", affectedIds, SqlBuilder.IN());
-}
-
+if (vars.exists("$local.idvalue"))
+    querySelect.whereIfSet("CONTACT.CONTACTID", "$local.idvalue");
 
 result.string(querySelect);
\ No newline at end of file