fixed the check for finding whether two leaves interact