cherry-pick Several small fixes, mostly related to spatial searches.