Fixed crash when loading images