The numerical solution of the stepped pressure equilibrium (Hudson et al 2012 Phys. Plasmas 19 112502) requires a fast and robust solver to obtain the Beltrami field in three-dimensional geometry such as stellarators. The spectral method implemented in the stepped pressure equilibrium code (SPEC) is efficient when the domain is a hollow torus, but ill-conditioning of the discretised linear equations occurs in the (solid) toroid due to the artificially singular coordinate parameterisation near the axis. In this work, we propose an improved choice for the reference axis to prevent coordinates surfaces from overlapping. Then, we examine the parity and asymptotics of the magnetic vector potential near the axis and suggest the use of recombined and rescaled Zernike radial basis functions. The maximum relative error in the magnetic field of the Wendelstein 7-X geometry is shown to reach 10−9 at high resolution in a series of convergence tests and benchmarks against the boundary integral equation solver for Taylor states. The new method is also reported to significantly improve the accuracy of multi-volume SPEC calculations. A comparison between free-boundary SPEC and the analytical Dommaschk potential is presented with higher-than-usual Fourier resolution. It is illustrated that we are able to resolve low amplitude current sheets when an interface is placed where there is no flux surface in the analytic solution. This was previously concealed because of insufficient numerical resolution.