improve server IP/hostname handling