fixed history search function