Change method to set count fixes #6430.