Detection or prevention of read or write errors