fixing sgd