fixed stats function