Fixing IP address detection