I am confused about a couple of steps in the proof of the birational invariance of the geometric genus (Theorem II.8.19 in Hartshorne's Algebraic Geometry).

I shall sketch the proof and highlight my doubts.

Let $X,X'$ be two birationally equivalent nonsingular projective varieties over a field k. Hence there is a birational map $X-->X'$ represented by a morphism $f:V\rightarrow X'$ for some largest open subset $V\subset X$.

Along taxonomic lines, the proof goes like this:

- We first prove that $f$ induces an injective map $f^{\ast}:\Gamma(X',\omega_{X'})\rightarrow \Gamma(V,\omega_V)$
- Then we prove that the restriction map $\Gamma(X,\omega_X)\rightarrow \Gamma(V,\omega_V)$ is bijective, using the valuative criterion of properness.

From this it follows that $\rho_g(X')\leq \rho_g(X)$, and the reverse inequality follows by simmetry.

In the proof of step 1: the map $f$ induces an isomorphism $U\cong f(U)$ for some open subset $U\subset V\subset X$ and then Hartshorne claims that this implies that f induces an isomorphism $\omega_{V|U}\cong \omega_{X'|f(U)}$. Why is that?

In the proof of step 2: from the valuative criterion of properness it follows that $\textrm{codim }(X\setminus V,X)\geq 2$. In order to prove that $\Gamma(X,\omega_X)\rightarrow \Gamma(V,\omega_V)$ is bijective it suffices to prove it on open sets $U\subset X$ trivializing the canonical sheaf $\omega_{X|U}\cong \mathcal{O}$, namely that $\Gamma(U,\mathcal{O}_U)\rightarrow \Gamma(U\cap V,\mathcal{O}_U\cap V)$ is bijective.

Since $X$ is nonsingular, from the first remark in the previous paragraph we have that $\textrm{codim }(U\setminus U\cap V,U)\geq 2$ and then Hartsorne claims that the result (bijectivity) follows immediately from the fact that for an integrally closed Noetherian domain $A$, we have $A=\bigcap_{\textrm{ht } \mathfrak{p}=1} A_{\mathfrak{p}}$. I do not see this either.

Thanks in advance for any insight.