some minor changes in SGD