Rewrite fixJobDirs to improve correctness
Second revision of fixTaskDirs implementation