SubDomains function bugfixed