Fix end condition in allWalks