fixing infinite loop detection in visitor