better encoding fixes