fixed occurence counting (I think)