Improved check for domain