Make IP parsing more robust