Fixed some errors in search result page and merged Habib's code