Fix gradient descent
More testing for gradients