v2.1.7 Squashed a couple of bugs in stats.py