Fixing some bugs with codepage changes.