training code
fix some backprop bugs