add infinite loop detector