Fixed code for search.js