util: fixed matrix transpose method