Add write/read failure handling.