Encoding messing with output