detect recursion