replace deprecated nnz with countnz