diff --git a/entity/Leadimport_entity/entityfields/load_data/onActionProcess.js b/entity/Leadimport_entity/entityfields/load_data/onActionProcess.js
index ba4625c09eed4652fc7cbf103ca0654f45bd56a7..5c2344a79aed4b60c4b7930f9b749999b22c69c1 100644
--- a/entity/Leadimport_entity/entityfields/load_data/onActionProcess.js
+++ b/entity/Leadimport_entity/entityfields/load_data/onActionProcess.js
@@ -8,7 +8,7 @@ import("Keyword_lib");
 import("Sql_lib");
 import("system.db");
 import("system.vars");
-
+import("Leadimport_lib");
 
 var assignmentRowId = vars.get("$field.LEADIMPORTID");
 var importDate = vars.get("$field.LEADIMPORT_DATE");
@@ -33,7 +33,7 @@ data = util.decodeBase64String(data);
 var table = text.parseCSV(data.replace(/(^\s+)|(\s+$)/g,""), recordSep, fieldSep, fieldLimit.charAt(0));
 
 var insertTable = "LEADTEMP";
-var insertCols = db.getColumns("LEADTEMP");
+var insertCols = LeadImportUtils.leadTempColumns();
 var insertTypes = db.getColumnTypes(insertTable, insertCols);
 var insertVals = [];
 
@@ -55,6 +55,7 @@ for (i = 0; i < table.length; i++)//and load new
     insertVals.push(importDate, util.getNewUUID(), importName, i.toString(), assignmentRowId);//push other necessary data for the insert
     toInsert.push([insertTable, insertCols, insertTypes, insertVals]);
 }
+
 db.inserts(toInsert); 
 
 question.showMessage("Daten wurden geladen! Zeilen: " + eMath.subInt(table.length, 1));
diff --git a/process/Leadimport_lib/process.js b/process/Leadimport_lib/process.js
index e347832498ae701f4e6b01c2cc488a4a440f50e0..3d89bd67276f108f12e05cd9a2d756e825bc8c7b 100644
--- a/process/Leadimport_lib/process.js
+++ b/process/Leadimport_lib/process.js
@@ -13,6 +13,62 @@ import("system.util");
 import("Sql_lib");
 import("system.db");
 
+/**
+ * functions for the lead import
+ * Do not create an instance of this!
+ *
+ * @class
+ * @static
+ */
+function LeadImportUtils(){}
+
+/**
+ * Returns the columns of the LEADTEMP table.
+ * Do not use db.getColumns("LEADTEMP"); as the order of the columns is not guaranteed!
+ * 
+ * @return {String[]} all columns
+ */
+LeadImportUtils.leadTempColumns = function() 
+{
+    return [
+        "COLUMN01",
+        "COLUMN02",
+        "COLUMN03",
+        "COLUMN04",
+        "COLUMN05",
+        "COLUMN06",
+        "COLUMN07",
+        "COLUMN08",
+        "COLUMN09",
+        "COLUMN10",
+        "COLUMN11",
+        "COLUMN12",
+        "COLUMN13",
+        "COLUMN14",
+        "COLUMN15",
+        "COLUMN16",
+        "COLUMN17",
+        "COLUMN18",
+        "COLUMN19",
+        "COLUMN20",
+        "COLUMN21",
+        "COLUMN22",
+        "COLUMN23",
+        "COLUMN24",
+        "COLUMN25",
+        "COLUMN26",
+        "COLUMN27",
+        "COLUMN28",
+        "COLUMN29",
+        "COLUMN30",
+        "IMPORT_DATE",
+        "LEADTEMPID",
+        "NAME",
+        "POSITION",
+        "ROW_ID"
+    ];
+}
+
 /*
 * Load the data
 *
@@ -993,28 +1049,22 @@ function scanLeadDups(pAllContactData){
 */
 function CheckDup( pLeadValues)
 {
-    //var condition =  " where ";
-    var condition =  SqlCondition.begin();
+    //  search whether the organisation already exists        
+    var query = newSelect("ORGANISATIONID, CONTACTID")
+                .from("ORGANISATION")
+                .join("CONTACT", "ORGANISATIONID = CONTACT.ORGANISATION_ID")
+                .join("ADDRESS", "ADDRESSID = ADDRESS_ID");
+        
     var fields;
 
     fields = ["ORGANISATION.NAME", "ADDRESS.COUNTRY", "ADDRESS.ADDRESS", "ADDRESS.CITY", "ADDRESS.ZIP", "ADDRESS.COUNTRY"];
-    condition.and("PERSON_ID is null");
+    query.and("PERSON_ID is null");
 
     for (var i = 0; i < fields.length; i++)
     {
-        condition.andPrepare(fields[i], pLeadValues[ fields[i].split(".")[1] ].replace(new RegExp("'", "g"),"''"));
-        condition.and(fields[i] + " is not null");
+        query.and(fields[i], pLeadValues[ fields[i].split(".")[1] ].replace(new RegExp("'", "g"),"''"));
+        query.and(fields[i] + " is not null");
     }
         
-    //  search whether the organisation already exists
-
-    var ids = db.array(db.ROW, SqlBuilder.begin()
-        .select("ORGANISATIONID, CONTACTID")
-        .from("ORGANISATION")
-        .join("CONTACT", "ORGANISATIONID = CONTACT.ORGANISATION_ID")
-        .join("ADDRESS", "ADDRESSID = ADDRESS_ID")
-        .where(condition)
-        .build());
-        
-    return ids;
+    return query.array();
 }
\ No newline at end of file