changed env codes
fixed typo in script, added ipv6 support
permissions fix
added basic logging