diff --git a/src/core/js/ext_autocomplete.js b/src/core/js/ext_autocomplete.js
index a45af3851d84f4dad8b1ec7ec38eec5f655c8697..2f6fa0dde729907f7248bd05367f26633872f39e 100644
--- a/src/core/js/ext_autocomplete.js
+++ b/src/core/js/ext_autocomplete.js
@@ -111,17 +111,6 @@ var ext_autocomplete = new function () {
             ["names"]))).find("Property[name],RecordType[name],Record[name]")
 
         response = response.toArray().map(x => $(x).attr("name"));
-        // attach quotation if white space
-        response = response.map((x) => {
-          if(x.indexOf(" ") > -1) {
-            if(x.indexOf("\"") > -1) {
-              return `'${x}'`;
-            } else {
-              return `"${x}"`;
-            }
-          }
-          return x;
-        });
         response = response.concat(ext_autocomplete.CQL_WORDS);
 
         return response
@@ -169,8 +158,16 @@ var ext_autocomplete = new function () {
         var start = newValue.slice(0, beginning_of_word + 1);
         var end = origJQElement[0].value.slice(cursorpos);
         var result = resultsFromServer.map(x => {
+            var x_quoted = x;
+            if (x.indexOf(" ") > -1) {
+              if(x.indexOf("\"") > -1) {
+                x_quoted = `'${x}'`;
+              } else {
+                x_quoted = `"${x}"`;
+              }
+            }
             return {
-                text: start + x + end,
+                text: start + x_quoted + end,
                 html: x
             }
         });