Fix encoding failures