adds conditional to check if dir exists