recursion and global variable