Fixed counter working with files