(jpeg) fix errors in encoder.