Let $\pi:\mathcal{C}\to S$ be a morphism of schemes such that $\mathcal{C} \subset \mathbb{C}^2 \times S$ with the inclusion map commuting with the natural projection to $S$ and for all $s \in S$, $\pi^{-1}(s)$ is a curve in $\mathbb{C}^2$ (under the restriction of the inclusion of $\mathcal{C}$ into $\mathbb{C}^2 \times S$). Suppose further that $S$ is an integral scheme. If for all $s \in S$, the $\delta$-invariant of the corresponding curve $\mathcal{C}_s:=\pi^{-1}(s)$ is constant, can we then say that $\pi$ is flat? I think this is true if $S$ is smooth. Here, I weaken it to integrality. 

Any hint/reference will be most welcome.