resolved some indexing issues in rebalance