Fixed counting issue