improve punycode logic