Fix get visited count bug