migrateImagesToSwift: avoid division by zero