bug fixes for segment metadata queries and spatial indexing