Fix spatialite exceptions