Fix to allow more generic JPEG handling.