Added check the existence of target directory