fixed global variable usage in recursion