fixed problem when occurrences are equal to 0