master: modified stats function