fixed matrix creation; now it works