added check for session var to keep track of subdomain