correct counting of files in directory