minor fixes to matrix_init