Add test to prove #5150
Fixes #5150
Fix CS error
Merge pull request #5151 from dakota/3.0-count-beforefind

Fixes #5150