fix bug in mahalDist.R