Fixed mk_matrix bug, still to test