In magnetohydrodynamics (MHD), the magnetic field is evolved by the induction equation and coupled to the gas dynamics by the Lorentz force. We perform numerical smoothed particle magnetohydrodynamics (Spmhd) simulations and study the influence of a numerical magnetic divergence. For instabilities arising from divergence B related errors, we find the hyperbolic/parabolic cleaning scheme suggested by Dedner et al. 2002 to give good results and prevent numerical artifacts from growing. Additionally, we demonstrate that certain current Spmhd implementations of magnetic field regularizations give rise to unphysical instabilities in long-time simulations. We also find this effect when employing Euler potentials (divergenceless by definition), which are not able to follow the winding-up process of magnetic field lines properly. Furthermore, we present cosmological simulations of galaxy cluster formation at extremely high resolution including the evolution of magnetic fields. We show synthetic Faraday rotation maps and derive structure functions to compare them with observations. Comparing all the simulations with and without divergence cleaning, we are able to confirm the results of previous simulations performed with the standard implementation of MHD in Spmhd at normal resolution. However, at extremely high resolution, a cleaning scheme is needed to prevent the growth of numerical errors at small scales.