euclidean distance fix