fixes algorithm for computing squared (Euclidean) distance.