I know that the surface $y^2-(z-a_1)\ldots(z-a_n)$ is a Riemann Surface (that is the Riemann surface of $\sqrt{P(z)}$ with $P(z)=(z-a_1)\ldots(z-a_n)$) of genus $g$ and that $g=\mathrm{dim}(\Omega(X))$, with $\Omega(X)$ the holomorphics 1-forms. In "Lectures on Riemann Surfaces" (17.15), Forster says that one has the basis $(\omega_j)_{j=1,\ldots,g}$ where $\omega_j=\frac{z^{j-1}dz}{\sqrt{P(z)}}$.
My problem is that when I prove the independence of this sequence I didn't use that the indices stopped at $g$ that is I had an infinite basis: if we have $\sum_j \lambda_j\omega_j=0$ then $\sum_j \lambda_j z^{j-1}=0$ and so with a Vandermonde determinant I conclude that the $\lambda_j=0$.
Where is my mistake?