If in a proceeding a person has been improperly or unnecessarily joined as a plaintiff or applicant and a defendant or respondent has set up a counterclaim, set-off or cross-application, the counterclaim, set-off or cross-application is not defeated by reason of the misjoinder.