added error message for singualr matrix. Not needed, but looks better