fixed stack recursion