Fix counter bug