Fix bug in stats module