added checks for existence of job