improved treatment of target_dir in tar_directory