fix sqdist