Fix logic for IOExeption handling, and make it user friendly