simplify and correct the logic for falling back to the entry ident when an invalid label id shows up; fixes #1399