loop detection debugging