Section 3. If, in an action in the supreme judicial or superior court in which trustee process is used in connection with the commencement thereof, the court finds that the trustee was made a party in order to give the court jurisdiction of the action in the county where the trustee dwells or has a usual place of business, and that neither the plaintiff nor the principal defendant dwells or has a usual place of business therein, it may, upon motion of the defendant at any time before trial, order the action and all papers relating thereto transferred to a county where some one of the principal parties dwells or has a usual place of business, upon terms. The action shall thereupon be entered and prosecuted in the same court for that county as if originally brought therein, and all prior proceedings otherwise regularly taken shall thereafter be valid.