Fixed some issues with branching - now correctly set referent relation.