Fixed some issues with encoding.