leave join func