Fixes to get the jpeg rendering working correctly