Question: After updating from TeXLive 2017 to 2021 we encountered the following issue with the appendix package: In documents with several appendices, after the first appendix, references using `\autoref` to sections are labeled with the word "Appendix" instead of "section". Here is a MWE and the output, once compiled using v1.2b of the appendix package and once using v1.2c.

MWE:

```
\documentclass{article}
\usepackage{appendix}
\usepackage{hyperref}

\begin{document}

\section{Section 1}
\label{sec:section1}

SEE \autoref{sec:section1}

\begin{appendices}
\section{Appendix Section 1}
\label{app:section1}
\end{appendices}

\section{Section 2}
\label{sec:section2}

SEE \autoref{sec:section2}

\begin{appendices}
\section{Appendix Section 2}
\label{app:section2}
\end{appendices}

\end{document}

```

output with:

* appendix v1.2b

[![enter image description here](https://i.stack.imgur.com/jHtVN.png)](https://i.stack.imgur.com/jHtVN.png)

* appendix v1.2c

[![enter image description here](https://i.stack.imgur.com/5GYqy.png)](https://i.stack.imgur.com/5GYqy.png)

Is there a way to achieve the reference being labeled with the word "section" with v1.2c?

Answer: 
It is imho a bug in appendix, it uses \xdef instead of \def. You could revert this for now with

```
\documentclass{article}
\usepackage{appendix,etoolbox}
\usepackage{hyperref}
\makeatletter
\patchcmd\@resets@pp{\xdef}{\def}{}{\fail}
\patchcmd\@resets@ppsub{\xdef}{\def}{}{\fail}
\makeatother

\begin{document}

\section{Section 1}
\label{sec:section1}

SEE \autoref{sec:section1}

\begin{appendices}
\section{Appendix Section 1}
\label{app:section1}
\end{appendices}

\section{Section 2}
\label{sec:section2}

SEE \autoref{sec:section2}

\begin{appendices}
\section{Appendix Section 2}
\label{app:section2}
\end{appendices}

\end{document}

```
While LaTeX treats appendices the same as chapters or sections, in this case you probably want them to be subsections. Incidentally, this also resolves the autoref problem.

[![demo](https://i.stack.imgur.com/or8aK.png)](https://i.stack.imgur.com/or8aK.png)

```
\documentclass{article}
\usepackage{hyperref}
\newenvironment{appendices}{\setcounter{subsection}{0}%
  \def\thesubsection{\thesection\Alph{subsection}}}{}

\begin{document}

\section{Section 1}
\label{sec:section1}

SEE \autoref{sec:section1}

\begin{appendices}
\subsection{Appendix Section 1}
\label{app:section1}
\end{appendices}

\section{Section 2}
\label{sec:section2}

SEE \autoref{sec:section2}

\begin{appendices}
\subsection{Appendix Section 2}
\label{app:section2}
\end{appendices}

\end{document}

```

---

Alternatively, this version uses a separate counter for appendices.

[![demo2](https://i.stack.imgur.com/xBlNR.png)](https://i.stack.imgur.com/xBlNR.png)

```
\documentclass{article}
\usepackage{hyperref}
\newcounter{appendix}
\newenvironment{appendices}{\edef\savesection{\arabic{section}}%
  \setcounter{section}{\value{appendix}}%
  \def\thesection{\Alph{section}}}%
{\setcounter{appendix}{\value{section}}%
  \setcounter{section}{\savesection}}

\begin{document}

\section{Section 1}
\label{sec:section1}

SEE \autoref{sec:section1}

\begin{appendices}
\section{Appendix Section 1}
\label{app:section1}
\end{appendices}

\section{Section 2}
\label{sec:section2}

SEE \autoref{sec:section2}

\begin{appendices}
\section{Appendix Section 2}
\label{app:section2}
\end{appendices}

```