improved math in test_counts