Fix counting error