modify the matrix