Adding safeguards i directory handling for task/instr managers.