Further changes (authored by Seberg)
Improved the tests for checking the consistency of count function