fix euclidean distance