  For a polycyclic group $\Lambda$, rank$(\Lambda )$ is defined as the number
of $\mathbb{Z}$ factors in a polycyclic decomposition of $\Lambda$. For a
finitely generated group $G$, rank$(G)$ is defined as the infimum of
rank$(\Lambda )$ among finite index polycyclic subgroups $\Lambda \leq G$.
  For a compact RCD$(K,N)$ space $(X,\mathsf{d}, \mathfrak{m} )$ with diam$(X)
\leq \varepsilon (K,N)$, the rank of $\pi_1(X)$ is at most $N$. In this note we
show that in case of equality, $X$ is homeomorphic to an infranilmanifold,
generalizing to the non-smooth setting a result by Kapovitch--Wilking. We also
fill a gap in the proof that if $\pi_1(X) = \mathbb{Z}^N$, then $X$ is
bi-H\"older homeomorphic to a flat torus (diffeomorphic in the smooth case).
