added alloc_matrix