Corrected domain_id determination logic in domain_id class