Fix IP validity checks.