Added re.escape to the modecheck to fix ipv6 addresses etc.