$f$ measurable with $f=g$ a.e. then $g$ measurable How do I prove this proposition from Royden's Real Analysis:

If $\mu$ is a complete measure and $f$ is a measurable function, then
  $f=g$ almost everywhere implies $g$ is measurable.

In proving this proposition, what differs from the proof of a proposition from the first chapters stating: 

If $f$ is a measurable function $f=g$ almost everywhere then 
  $g$ is measurable.

In particular, what has to be modified in the following proof:
Take $E=\lbrace x \in X | f(x) \neq g(x) \rbrace,$ which is measurable and has measure $0$. For a measurable set $A$ in the range of $g$, we show that the set $Y=g^{-1}(A)$ is measurable. Now, $Y \cap E$ has is measurable with measure $0$. Since $Y \setminus E = f^{-1}(A) \setminus E$ is a difference of two measurable sets, we are done.
 A: Please, check assumptions of the proposition from the first chapters. When you are saying that $Y\cap E$ is measurable - how do you know this? You are not given that $Y$ is measurable, you have to prove it. But in case the measure is complete, by the definition of completeness if follows that 
$$
  Y\cap E \subset E\text{ and }\mu(E) = 0\quad \Rightarrow \quad Y\cap E \text{ is measurable}.
$$
Without completeness you can only conclude that $Y\cap E$ is $\mu$-null which does not imply measurability in general.
A: To fix notation: Suppose that $(X,\mathcal{A},\mu)$ is a complete measure space, $(Y,\mathcal{B})$ is a measure space and that $f:X \to Y$ is measurable. We have to show that
$$g^{-1}(B) \in \mathcal{A}$$
for all $B \in \mathcal{B}$. Now
$$\begin{align*} g^{-1}(B) &= \{x; g(x) \in B \} \\ &= \underbrace{\{x; g(x) \in B, f(x)=g(x)\}}_{=:A} \cup \underbrace{\{x; g(x) \in B, g(x) \neq f(x)\}}_{=:N}. \end{align*}$$
By definition, we have
$$N \subseteq \{x; f(x) \neq g(x)\}.$$
Since $f=g$ almost everywhere, this shows that $N$ is a subset of a nullset; hence measurable as $\mu$ is complete. Moreover,
$$\begin{align*} A &= \{x; g(x) \in B, f(x)=g(x)\} \\ &= \{x; f(x) \in B, f(x)=g(x)\} \\ &= \{x; f(x) \in B\} \cap \{x; f(x)=g(x)\} \end{align*}$$
is measurable as the intersection of two measurable sets (the first set at the right-hand side is measurable because $f$ is measurable and for the second one we note that
$$\{x; f(x)=g(x)\} = X \setminus \{x; f(x) \neq g(x)\}$$
is the complement of a measurable set and therefore measurable.)
