Set image format when migrating old images.
Fix another core data deadlock.