Fix the bug that fail to detect copying directory into itself.