Fix the case where ndim == 0 for all() and any().