image error handling fixes