ensure that dir is unique