Fix two bugs in the global balancing phase