Bug fix to sub search