fix and tests for #469
Merge branch 'wrong_count'