fix recursion issues