Fix crashes when calculating hash of dir symlinks