fixed matrix length problems