Fixed a mistake with singular matrices