Section 36. If doubts arise as to the legality of the organization of any corporation created by special charter for a purpose mentioned in this chapter, which is in the exercise of its franchise, or as to the regularity or sufficiency of the proceedings of any such corporation, whether created by special charter or formed under general laws, in consequence of failure subsequent to the organization to comply with the directions or requirements of any statute, the stockholders, at a special meeting called for the purpose in the manner provided in section eight of chapter one hundred and fifty-six or by a justice of the peace upon the written request therefor of a majority of the acting directors, may by vote confirm such defective proceedings and all subsequent proceedings of the corporation dependent thereon. The clerk shall thereupon make a certificate on oath setting forth the particular matters especially causing the doubt, and a copy of the call of the meeting and of the vote of the stockholders, and the date of holding the meeting, which he shall present to the secretary who shall examine the same, and, if he finds that this section has been complied with, shall so certify by endorsement thereon. Upon filing the certificate so endorsed in the office of the state secretary, such proceedings shall be taken to be legal and valid as fully as if the requirements of the statutes had been complied with.