add some error handling around the read operation