More tweaks to image optimization