stochastic gd verified working, misc. bugfixes