Minor fixes about shared gradients