Improve handling of directory symlinks.