Fixed exception handling for stats.py

There was a really derpy bug in there