fix bugs in stats generator