fixed bug in sparse matrix (variable j1)