bug fixed in rms distance