fixed typo so non-square matrices work