infinite loop detection