fixed encoding glitches