Fix a couple of bugs in the global balancing phase

Ensure that we don't try to move a shard twice, and fix a key formatting
mismatch.