fix bug in utf8 handling