fixing the matrix data