Fix signed/unsigned comparison warnings.
Fix unreachable code warnings.