Fixed a bug in calculation of MahalanobisDistance