fix user agent unicode/str convertion