fixed duplicate $domain variable.