Replaced TypeError with MatrixError