Test case and fix for deferred jobs.

Closes #2033