fix compiler warnings, and added distanceSqr for vectors