Fix major bug in spatial type autodetection.