Fix rebalance-related bugs#3