fixed rte stack overflow due to recursion