join recursion function works