My 3 pages long article having the following code in the preamble produces "Page x of ??" in the header, rather than "Page x of 3" (where x stands for current page number).
What am I missing?
\usepackage{lastpage}
\usepackage{scrpage2}
\pagestyle{scrheadings}
\clearscrheadfoot
\ohead{Page \thepage\ of \pageref{lastpage}}
\documentclass{...}
and ending with\end{document}
.