[OPT] small optimization in package validator.