debugging the alreadyVisited problem