[Counter 2] Fix potential NaN output