several corner case fixes for vectorWeightedDist