isMetricSpace check added