fixed some issues with encoding