Fix some index calculations. All tests green.