fixing the recursion problem