debugged the modified stats table generation code