Fix inv for triangular matrices