diff --git a/core/misc/machine-name.js b/core/misc/machine-name.js
index bbad2e3..693a048 100644
--- a/core/misc/machine-name.js
+++ b/core/misc/machine-name.js
@@ -80,7 +80,8 @@
         timeout = setTimeout(function () {
           if (baseValue.toLowerCase() !== expected) {
             xhr = self.transliterate(baseValue, options).done(function (machine) {
-              self.showMachineName(machine.substr(0, options.maxlength), data);
+              machine = machine.replace(/^_+/, '').substr(0, options.maxlength).replace(/_+$/, '');
+              self.showMachineName(machine, data);
             });
           }
           else {
