fix cash flow

Fixed loop issue. Results not tested.