better handling of file access errors