fixed visited algorithm (use original Xi-i for seen)