Fix bug: scheduled jobs with retry never finish

fixes #900