sgd: small optimization