Repaired recursion bug