fixed a bug when calling the print_stats function