fixed image encoding/decoding issue