Bugfix in function to compute stats for display