Add error handling to read