fixed some problems with encoding.