issue #73:check if there's pending jobs before getting their id