Adding exception handling for files with errors