Fix a c+p error in the safe read/write code, and make it more obvious when that fails.