Small fix for sgd