fixed matrix-inverse errors