Fixed: check image is intact before loading it