fix some logic that made internal break during search
Merge branch 'canonicalfix' into release-149