Fixed stats computation in new stats query