I have the following proof of the Krylov-Bogoliubov theorem, which asserts that given a compact metric space $X$ endowed with a continuous transformation $T \colon X \to X$ one can find a $T$-invariant Borel probability measure $\mu$:
Let
$$S_f^N(x) = \frac{1}{N} \sum_{n = 0}^{N-1} f(T^n(x))$$
and fix $x \in X$. Let $\mathcal{F}$ be a countable dense subset of $\mathcal{C}(X, \mathbb{R})$.
Using a diagonalization argument and the fact that $f(X)$ is bounded, it's easy to prove that there exists a strictly increasing sequence $N_k$ such that $S_f^{N_k}(x)$ converges for every $f \in \mathcal{F}$.
Because $\mathcal{F}$ is dense in the uniform topology, $S_g^{N_k}(x)$ also converges for every $g \in \mathcal{C}(X, \mathbb{R})$. Let $S_g(x) = \lim_{k \to \infty} S_g^{N_k}(x)$.
Let $L_x(g) = S_g(x)$. Then $L_x \colon \mathcal{C}(X, \mathbb{R}) \to \mathcal{R}$ is a continuous positive linear functional.
By the Riesz representation theorem, there is a regular measure $\mu$ on $\mathcal{B}(X)$ such that
$$L_x(g) = \int_X g d\mu$$
for every $g \in \mathcal{C}(X, \mathbb{R})$. A simple computation shows that $L_x(g \circ T) = L_x(g)$ for every $g \in \mathcal{C}(X, \mathbb{R})$, so
$$\int_X g d\nu = \int_X g \circ T d\mu = \int_X g d\mu$$
for every $g \in \mathcal{C}(X, \mathbb{R})$, where $\nu = \mu(T^{-1}(\cdot))$. Since $\nu$ is a finite measure and $X$ is compact and metrizable, it follows that $\nu$ is also regular. This proves that $\mu = \nu$, so $\mu$ is $T$-invariant.
My problem is that this proof doesn't seem to need the continuity of $T$, whereas there are examples that show that measurability alone isn't enough for the proof.
What am I missing?
Thanks in advance.
Continuity of $T$ is needed when we write the equality $L_x(g\circ T)=L_x(g)$. Indeed, $L_x$ acts on continuous functions, and we need $T$ continuous in order to guarantee that so is $g\circ T$.