updated the matrix