Fix deep recursion