Fix encoding/decoding issue