Fix rebalancing and output