Fixes for working with JPEGs