fix backprop gain recursion