finds and fixes bug relating to encoding issues