Second part of history-substring-search issue fix