Fix image corruption in JPEG decoding.