fix counter update