fixed matrix bug in python module