improved handling of internal domains