fixed small memory leak - how to deal with encoding problems?