Fixes UnicodeEncodeError sometimes