Fixed typo in search.js, but I don't know the code well enough to fix the other bugs.