fixed duplicate recursion