change np.any to np.all