Fix distance bug.

(matrix - a point) will provide unexpected result.