Fix total count in case of directories.