fixed recursion issue