Fixed wrong logic determining the top-level domain