add image read error handling