Fix I/O errors and work around borrow failures.