fixed bug in utf based decoding