fix lockup when many jobs are scheduled at the same time