alreadyvisited bug fix