resolved recursion bug