Add error handling of image loading