fix sparse matrix A