Adding error control to files