Fixed problems with encoding