# Using (redefined) macro in \caption doesn't work, but it works in another environment

My problem is strange behavior my command \vec{} in \caption. I used this construction:

\renewcommand{\vec}[1]{\accentset{\rightarrow}{#1}}

See my code:

\documentclass[12pt, a4paper, czech, twoside]{book}
\usepackage{amsmath, amsthm, amssymb, amsfonts, amsbsy}
\usepackage{accents}
\usepackage{fontspec,xltxtra,xunicode,unicode-math}
\setmainfont[Mapping=tex-text,Numbers={OldStyle,Proportional}]{Calibri}
\setsansfont[Mapping=tex-text,Numbers={OldStyle,Proportional}]{Candara}
\setmonofont[Numbers=OldStyle]{Consolas}
\setmathfont{Cambria Math}
\usepackage{tikz}

\begin{document}

\renewcommand{\vec}[1]{\accentset{\rightarrow}{#1}}

\begin{figure}[hb!]
\centering
\begin{tikzpicture}
\coordinate (dS) at (2,0.5);
\draw[->] (dS) ++ (0.25,0.25) -- +(1,0.5) node[right]{$\vec{n}$};
\draw[->] (dS) ++ (0.25,0.25) -- +(2,1.5) node[right]{$\vec{h}$};
\end{tikzpicture}
\label{FYZ:fig_01}
\caption{vector $\vec{n}$.}
\end{figure}

\end{document}

SW: MiKTeX 2.9 64 bit up to date. When I try to use the command \vec in a tikzpicture environment, everything all right, but with caption an error occurs. I don't understand it. What am I doing wrong?

-