Adding null check of currentVisits before updating counter