fixed history substring search