IPv4-IPv6 detection and fix undefined index in results var