Fix clustering distance measure with integer layers