Let $(X , \mathcal{O}_{X})$ be a locally ringed space. I know that in general it is not true that locally free $\mathcal{O}_{X}$ modules are projective in the category of $\mathcal{O}_{X}$ modules (this post on mathoverflow gives a counterexample on an integral affine scheme). As it is so, I don't understand where is the flaw in the following proof.
If $\mathcal{F}$ is a finitely presented $\mathcal{O}_{X}$, i.e. locally it there exists an exact sequence $$ \mathcal{O}_{X}^{n} \rvert_{U} \rightarrow \mathcal{O}_{X}^{m} \rvert_{U} \rightarrow \mathcal{F} \rvert_{U} \rightarrow 0 $$ where $U \subset X$ is an open subset, then for every $\mathcal{O}_{X}$ module $\mathcal{G}$ we have a natural isomorphism $$ \mathcal{H}om_{\mathcal{O}_{X}} \left( \mathcal{F}, \mathcal{G} \right) _{x} \simeq \text{Hom}_{\mathcal{O}_{X,x}} \left( \mathcal{F}_{x} , \mathcal{G}_{x} \right) $$ where $x \in X$ and the subscript means the stalk of the sheaf. Therefore, if we have an exact sequence $$ 0 \rightarrow \mathcal{G}' \rightarrow \mathcal{G} \rightarrow \mathcal{G}'' \rightarrow 0 $$ applying $\mathcal{H}om_{\mathcal{O}_{X}} \left( \mathcal{F}, - \right)$ we get the exact sequence $$ 0 \rightarrow \mathcal{H}om_{\mathcal{O}_{X}} \left( \mathcal{F}, \mathcal{G}' \right) \rightarrow \mathcal{H}om_{\mathcal{O}_{X}} \left( \mathcal{F}, \mathcal{G} \right) \rightarrow \mathcal{H}om_{\mathcal{O}_{X}} \left( \mathcal{F}, \mathcal{G}'' \right). $$ Now, if $\mathcal{F}$ is locally free on rank $n$, looking at the stalk at a point $x \in X$ and using what said before this exact sequence corresponds to the sequence $$ 0 \rightarrow \mathcal{G}'^{\oplus n}_{x} \rightarrow \mathcal{G}^{\oplus n}_{x} \rightarrow \mathcal{G}''^{\oplus n}_{x} $$ which is also exact on the right. Hence, the sequence with the $\mathcal{H}om$ is exact, and $\mathcal{F}$ is projective.
Where am I losing something?