Fix handling of failed image loads.