added minVar and maxVar in calls to do_stats