Fix DB querying of domain names