Fixed AFM-57

Don't throw ReferenceNotFound until we've handled the entire fragment
and verified that the value is actually missing.