Small bugfix

Fixed silly issue in Gauss, where trying to scale the diagonal elements up to 1 resulted in division by zero.

Added check for determinant != 0 in invert to prevent the same issue.