Fix IP range checking