--- orig/js/misc/history.js
+++ new/js/misc/history.js
@@ -69,7 +69,7 @@
             this._indexChanged();
         }
 
-        return this._historyIndex[this._history.length];
+        return this._history[this._historyIndex];
     },
 
     addItem: function(input) {
