Fix sorting bug which caused missed sub-domains