When pivot is 0, the row permutation code was not correct and failing on some matrixes (but not all matrixes).