fixed optional element counting in statistics