Fixing problems with sph simulations