the segfault is gone, but Mahalanobis still gives the wrong answer