No action shall be dismissed for misjoinder of parties, or dismissed for nonjoinder of necessary parties without first affording reasonable opportunity to add them as parties. New parties may be added and parties misjoined may be dropped by order of the court, at any stage of the cause, before or after judgment, as the ends of justice may require and on terms which the court may fix.
735 ILCS 5/2-407