Fix bug in resubmit if njobs failed > 500