fix for getGradientAndObj returning 2*objective