Fix custom subdomain routing if the custom domain has subdomains, and
some other minor improvements