bug fixed (SumofDistances)