Bug fix in balance_queues()