fix levels index for hierarchies