Changes to fix the problem with spatialIndex
Changes to fix the problem with spatialIndex