bug fix in sgd.py