Bug fix

I still need to write tests for the stats files.