diff --git a/src/core/js/edit_mode.js b/src/core/js/edit_mode.js
index 1a2c9092c2b6d234cc52691089c7094e93c49a2a..b9e9e995239b0576bed3638cb18063decac3115a 100644
--- a/src/core/js/edit_mode.js
+++ b/src/core/js/edit_mode.js
@@ -1033,14 +1033,16 @@ var edit_mode = new function () {
                         $(manualInsertButton).click(function () {
                             // toggle input
                             // forward:
-                            if ($(result).find('input.caosdb-f-manual-id-insert').is(':hidden')){
+                            if ($(result).find('input.caosdb-f-manual-id-insert').is(':hidden')) {
                                 // show ID input; hide dropdown
                                 $(result).find('.dropdown').hide();
                                 $(result).find('input.caosdb-f-manual-id-insert').show();
                                 $('.caosdb-f-entity-save-button').hide()
                             } else {
                                 // backward:
-                                $(result).find('input.caosdb-f-manual-id-insert')[0].dispatchEvent(new KeyboardEvent('keyup', {'key':'Enter'}));
+                                $(result).find('input.caosdb-f-manual-id-insert')[0].dispatchEvent(new KeyboardEvent('keyup', {
+                                    'key': 'Enter'
+                                }));
                             }
                         });
                         // Add input for manual ID insertion
@@ -1053,8 +1055,8 @@ var edit_mode = new function () {
                                 // was entered to the candidates and select that item
                                 $(result).find('input.caosdb-f-manual-id-insert').hide();
                                 var sel_id = $(result).find('input.caosdb-f-manual-id-insert')[0].value
-                                if (sel_id!=""){
-                                    if ($(result).find(`option[value="${sel_id}"]`).length==0){
+                                if (sel_id != "") {
+                                    if ($(result).find(`option[value="${sel_id}"]`).length == 0) {
                                         select.append(`<option value="${sel_id}">ID: ${sel_id}</option>`);
                                         // workaround for selectpicker bug (options are
                                         // doubled otherwise)
@@ -1893,12 +1895,14 @@ var edit_mode = new function () {
     this.retrieve_datatype_list = async function (datatype) {
         var find_entity = ["FILE", "REFERENCE"].includes(datatype) ? "" : `"${datatype}"`;
         const max_options = parseInt("${BUILD_MAX_EDIT_MODE_DROPDOWN_OPTIONS}"); //for each query; there might be more candidates in total
-        if (max_options != -1){
+        console.log(max_options);
+        var query_suffix = max_options != -1 ? `&P=0L${max_options}` : "";
+        if (max_options != -1) {
             var n_entities = datatype !== "FILE" ? await edit_mode.query(`COUNT Record ${find_entity}`, true) : 0;
             var n_files = await edit_mode.query(`COUNT File ${find_entity}`, true);
         }
-        var entities = datatype !== "FILE" ? edit_mode.query(`FIND Record ${find_entity}&P=0L${max_options}`, true) : [];
-        var files = edit_mode.query(`FIND File ${find_entity}&P=0L${max_options}`, true);
+        var entities = datatype !== "FILE" ? edit_mode.query(`FIND Record ${find_entity}${query_suffix}`, true) : [];
+        var files = edit_mode.query(`FIND File ${find_entity}${query_suffix}`, true);
 
         await Promise.all([entities, files])
 
@@ -1907,7 +1911,7 @@ var edit_mode = new function () {
             .concat(edit_mode
                 ._create_reference_options(await files));
 
-        if (max_options !=- 1 && (n_entities > max_options || n_files > max_options)) {
+        if (max_options != -1 && (n_entities > max_options || n_files > max_options)) {
             // add notification that not all entities are shown
             options = [$(`<option disabled=true value="NA"/>`).text(
                 `More than ${max_options} possible options; showing only a subset. You may need to enter the id manually.`