Fix some bugs with sub-searching.