Proving that an integral is a holomorphic function Let $U\in \mathbb C$. Let $f:U\to\mathbb C$ be analytic on $U$ and continuous on the boundary of $U$. I want to prove that, for each $a\in U$, and sufficiently small $r>0$, 
$$
g(w)=\frac{1}{2\pi i}\int_{|z-a|=r}\frac{zf'(z)}{f(z)-w}dz
$$
defines a holomorphic function.
My attempt: Assume for a moment that $f$ is injective (not actually valid). Using the substitution $x=f(z)$, we get
$$
g(w)=\frac{1}{2\pi i}\int_{|f^{-1}(x)-a|=r}\frac{f^{-1}(x)}{x-w}dx=f^{-1}(w)
$$
by Cauchy integration formula, since $f^{-1}$ is analytic (because $f'(z)\neq0$).
Is this valid? I feel something missing. For example, I have not addressed the condition "sufficiently small r". What's wrong?

Let $n$ be the order of the zero of $f(z)-f(a)$ at $z=a$. 
$$f(z)- f(a)= f^{(n)}(a) (z-a)^n+O((z-a)^{n+1})$$
For $r$ small enough then $f(z)-f(a)-w, |z-a|=r$ doesn't vanish on $|w| < R= \frac12 |f^{(n)}(a)| r^n$ so that $$g(f(a)+w)=\frac{1}{2\pi i}\int_{|z-a|=r}\frac{zf'(z)}{f(z)-f(a)-w}dz$$ is analytic on $|w| < R$.
Iff $n=1$ then $g(w) = f^{-1}(w)$ (proving the latter is locally analytic). If $n=2$ then the substitution $u = f(z)$ in the integral transforms the simple loop $|z-a| = r$ into a double loop around $f(a)$. 
You can use the residue theorem to express $g(f(a)+w)$ in term of $f^{-1}$.
