fix potential bug when handling beamer latexmode metadata