more error handling for large files