Fix reversed rows and columns when computing distances
Merge pull request #154 from marinkaz/distances

Fix reversed rows and columns when computing distances