Fix has cookie handling

Fix dot counting logic.

If no dots in domain (e.g. localhost), then need to leave domain property out of cookie instead of setting domain with value of null.