# beamer: wrong totalframenumber when hiding whole frames with mode/overlay specifications

I'd like to show a slide only on the projector but not have it in the handout. The most natural thing to implement this seems to be mode specifications as in the example below. This works fine... apart from the nuisance of messing up the value inserted by \inserttotalframenumber. Note that when built as is (i.e., as a handout) the second frame is hidden as intended but the total number of frames on the bottom right is wrong (2).

\documentclass[handout]{beamer}

\begin{document}

\begin{frame}{title 1}
\end{frame}

\begin{frame}<beamer|second>{title 2}
\end{frame}

\end{document}


Why does this happen and how to fix it? Is this a bug in beamer?

One workaround/alternative solution is to use the \mode command explicitly. NB: This requires to turn it off explicitly as well (and the newline after the second \mode is mandatory).

\documentclass[handout]{beamer}

\begin{document}

\begin{frame}{title 1}
\end{frame}

\mode<beamer|second>
\begin{frame}{title 2}
\end{frame}
\mode
<all>

\begin{frame}{title 3}
\end{frame}

\end{document}