Fix longstanding load balancing bug in the scheduler