Fix rebalance-related bugs#2