fixing gradients