fix the counter bug