fix Encode