fixes count of variable occurrences for each type