modify method of directory check