Fix barycenter and meanDirection bug