Added extra check when deciding if a job is completed.