fix example code snippet for stats api