  Let $\Bbbk$ be a field of characteristic $p>0$, $V$ a finite-dimensional
$\Bbbk$-vector-space, and $G$ a finite $p$-group acting $\Bbbk$-linearly on
$V$. Let $S = \Sym V^*$. We show that $S^G$ is a polynomial ring if and only if
the dimension of its singular locus is less than $\rank_\Bbbk V^G$. Confirming
a conjecture of Shank-Wehlau-Broer, we show that if $S^G$ is a direct summand
of $S$, then $S^G$ is a polynomial ring, in the following cases:
\begin{enumerate}
  \item $\Bbbk = \bbF_p$ and $\rank_\Bbbk V^G = 4$; or
  \item $|G| = p^3$. \end{enumerate} In order to prove the above result, we
also show that if $\rank_\Bbbk V^G \geq \rank_\Bbbk V - 2$, then the Hilbert
ideal $\hilbertIdeal_{G,S}$ is a complete intersection.
