diff --git a/res/search.js b/res/search.js
index 2e41aecda8764847faa00027879ae4671e084a47..52b1f9b432d26f55386f1502b6bed04a50aff966 100644
--- a/res/search.js
+++ b/res/search.js
@@ -21,7 +21,7 @@ var search_history = {
             return x != query;
         }).reverse();
         tmp.push(query);
-        localStorage.setItem('history', JSON.stringify(tmp.slice(Math.max(0, tmp.length - tmp.max_size))));
+        localStorage.setItem('history', JSON.stringify(tmp.slice(Math.max(0, tmp.length - search_history.max_size))));
     }
 };