set domain before using $domain