fix for np.count_nonzero not present in Numpy < 1.6