Fixed bug with surrogate pairs in the UserAgent string
Small refactoring