adding unknown referer error handling and better exception handling