fixed matrix compatability errors