fix bug in stochasticGradientDescent