Optimization process now works, but bellman equation is unstable