This is something of a follow-up question to [this one](https://mathoverflow.net/questions/43255/); I hope people won't think this is a duplicate. At least in my head, it seems like a distinct enough question to merit a fresh start.


All my schemes will be finite type over an algebraically closed field $k$. Let $X\to S$ be a flat family of affine schemes over smooth affine base. Let's say for now that each fiber and the whole family have rational singularities, and thus are Cohen-Macaulay. Assume, furthermore, that $X$ has an action of the group scheme $T=(\mathbb{G}\_m)\_S$; this is the same data as a grading on $k[X]$ such that $k[S]$ has degree 0.


Now, we can take the schematic fixed points $X^T$ of this family, which is a subscheme of $X$ whose points over any ring are invariant points of $X$. Concretely, this is the vanishing set of the ideal generated by all functions of non-zero degree. 



> 
> Must the morphism $X^T\to S$ be flat? If not, are there stricter hypotheses than I gave above which would assure it is?
> 
> 
> 


For example, consider the family $$X=\mathrm{Spec}[x,y,z,a\_0,\dots, a\_{n-1}]/(xy=z^n+a\_{n-1}z^{n-1}+\cdots + a\_0)$$ where $S=\mathrm{Spec}[a\_0,\dots, a\_{n-1}]$ with $x$ having degree 1, $y$ degree $-1$ and $z,a\_i$ having degree 0. In this case $$X^T=\mathrm{Spec}[z,a\_0,\dots, a\_{n-1}]/(z^n+a\_{n-1}z^{n-1}+\cdots + a\_0=0),$$ which is, of course, flat over $S$, even though the number of closed points in a fiber (the number of roots of $z^n+a\_{n-1}z^{n-1}+\cdots + a\_0$) varies from $n$ to $1$.



Under what hypotheses are schematic fixed points of a flat deformation themselves flat?
Here is a counterexample. Let $\mathbb G\_{\rm m}$ act on $\mathbb A^2$ by $t\cdot(x,y) = (tx,t^{-1}y)$, and let $f\colon \mathbb A^2 \to \mathbb A^1$ be defined by $f(x,y) = xy$.


I am positive that when $X$ is smooth over $Y$, the fixed point scheme is also smooth; but I doubt that one can say much more, in general.


[Edit] Here is a variant. Let $\mathbb G\_{\rm m}$ act on $\mathbb A^4$ by $t\cdot(x,y, z, w) = (tx,t^{-1}y,tz,t^{-1}w)$, and let $f\colon \mathbb A^4 \to \mathbb A^1$ be defined by $f(x,y) = xy + zw$.


