fix NPE

fix NPE when some dimension or metric is not present one of the segments
to be reIndexed.