adding error checking to AFC, fixing tests to validate properly