change count_nonzero in nlattice to work with older numpy