fixed recursion issues