Added exception handling for ImageIO class