OPINION OF THE COURT BY
MARUMOTO, J.This case involves a female child born on August 26, 1967. At the time of her birth,, her natural parents were *396unmarried high school students, both 17 years old, the natural father having been born on March 9, 1950, and the mother on March 18,1950.
On August 28, 1967, the mother executed her consent to the placement of the child with persons selected by her physician as adoptive parents and to the adoption of the child by such persons.
The physician selected a married couple, both 43 years old, who had one adopted daughter 3 years old, as the adoptive parents and placed the child with them on September 1, 1967.
The adoptive parents so selected filed their petition for the adoption of the child in the family court on November 30, 1967.
On January 12, 1968, the physician instituted a proceeding in the same court to obtain an order (1) confirming the mother’s consent to adoption and denying permission for its withdrawal; (2) determining, in the best interests of the child, that the natural father and his parents had no interest in her care, custody, and control and in the pending petition for her adoption; and (3) permitting the petition for adoption to be heard without the intervention of the natural father, his parents, the. mother, and her parents. This was done by the filing of a motion for an order to show cause directed to the guardian ad litem of the mother, the parents of the mother, the guardian ad litem of the natural father, and the parents of the natural father.
The physician filed the motion because the natural father had written to him on November 4, 1967, that he and the mother planned to be married and did not want the child to be adopted, and the mother had written to him on November 8, 1967, that she wanted “to withdraw from the adoption” and to have the child placed in the *397custody of the parents of the natural father until the natural father and she could be married.
On the motion, the court held extensive hearings at which it heard the testimonies of the attorney who had obtained the mother’s consent to adoption, the physician, the mother, her parents, the natural father, his mother, and the social worker of the department of social services who had worked on the case.
From the testimonies, the court found that the only realistic alternatives were adoption by the parents of the natural father and adoption by the adoptive parents selected by the physician; that the latter alternative would serve the best interests of the child; that the mother gave her consent to adoption freely and voluntarily; that permitting the mother to withdraw her consent would not be in the child’s best interests; and that the motion filed by the physician should be granted. A decision containing these findings was filed on August 6, 1968, and an order effectuating the findings was entered on August 20, 1968.
However, on August 19, 1968, the day before the entry of the order, the natural parents were married in California, as permitted by the statute of that state. Under the applicable statute of Hawaii, they could not have married until March 18, 1970. HRS § 572-2 requires parental consent to the marriage of a minor. The parents of the natural father were willing to give their consent, but the parents of the mother were unwilling to do so.
On August 20,1968, the natural parents filed a motion to vacate the order entered on that day, as well as the decision of August 6, 1968, and also to have the child restored to them, on the grounds that they were her natural and legal parents, that the requisite consent to her adoption had not been given, and that her best interests would be served by the restoration.
*398On this motion, the court again held extensive hearings at which it heard the testimonies of the natural parents, the paternal grandfather, and two psychiatrists. These hearings were held to adduce further evidence regarding the best interests of the child.
On April 22, 1969, the court filed a supplemental decision in which it reiterated the findings set forth in its decision of August 6, 1968, and ruled that the marriage of the natural parents might be a circumstance to be considered in the pending petition, for adoption but did not limit its jurisdiction to hear and determine that petition. An order pursuant to the supplemental decision was entered on April 24, 1969. This appeal has been taken by the natural parents from that order.
Four questions have been raised on this appeal: first, whether the marriage of the natural parents made thé consent of the natural father a prerequisite to adoption, in addition to the consent of the mother; second, whether the consent of the mothér was obtained under duress; third, whether the court erred in its refusal to permit the mother to withdraw her consent; and, fourth, whether the mother was deprived of any constitutional right when portions of the hearings on thé motion filed by the physician were held without her personal presence.
Of the questions stated above, the last three do not require extended discussion. The second and the third questions are premised on the findings made by the court upon its evaluation of the evidence before it and the credibility of witnesses. We cannot say that those findings are clearly erroneous. As a matter of fact, the findings are amply supported by the record. With respect to the fourth question, we do not see any constitutional infirmity. On the first two days of the hearings on the physician’s motion, held when she was out of this jurisdiction, the mother was represented by her guardian ad litem, who is *399a licensed attorney. At all other times, the mother was personally present and was accorded ample opportunity to testify. Her testimony is recorded in 95 pages of the transcript.
The first question would not have arisen if the mother had given her consent to adoption after July 11, 1969, the effective date of S.L.H. 19.69, c. 183. S.L.H. 1969, c. 183 amended HRS § 578-2 to provide that consent to adoption is not required of “the natural father of an illegitimate child who has not legally been legitimated either prior to the placement of the child with adoptive parents or prior to the execution of a valid consent by the mother of the child.”
S.L.H. 1969, c. 183 is not retroactive. Consequently, the question here must be considered under HRS § 578-2 as it stood before the amendment. Hereafter, in this opinion, any reference to HRS § 578-2 will be to that statutory provision before the amendment.
HRS § 578-2 provided that “in all cases of adoption written consent shall be given by each of the living legal parents”; that any parental consent “shall be valid and binding even though it does not designate any specific adoptive parent or parents, if it clearly authorizes * * * some proper person not forbidden by law to place a child for adoption, to select and approve an adoptive parent or adoptive parents for the child”; and that such consent “may not be withdrawn or repudiated after the child has been placed for adoption, without the express approval of the judge based upon a written finding that such action will be for the best interests of the child.”
Relevant to HRS § 578-2 is HRS § 338-21, which provides: “All children born out of wedlock * * * become legitimate on the marriage of the parents with each other and are entitled to the same rights as those born in wedlock * * * ”
*400Although HRS § 338-21 is presently a part of the chapter on vital statistics, the quoted portion is a substantive provision governing legitimation, and has been in effect since 1866. Laws of 1866-67, Act of May 24, 1866.
A literal reading of HRS § 578-2 with HRS § 338-21 would require the natural father’s consent after his marriage to the mother because by that marriage the natural father became a “legal parent”. But statutes are not always literally construed. Yoshizaki v. Hilo Hospital, 50 Haw. 150, 153, 433 P.2d 220, 222 (1967); Appeal of Chung, 44 Haw. 220, 228, 352 P.2d 846, 850 (1960); Chang v. Meagher, 40 Haw. 96, 102 (1953); Rathburn v. Kaio, 23 Haw. 541, 544 (1916); Holy Trinity Church v. United States, 143 U.S. 457, 459 (1892); National Woodwork Manufacturers Ass’n v. National Labor Relations Board, 386 U.S. 612, 619 (1967).
In Holy Trinity Church v. United States, supra, the court stated: “It is a familiar rule, that a thing may be within the letter of the statute and yet not within the statute, because not within its spirit, nor within the intention of its makers. This has been often asserted, and the reports are full of cases illustrating its application. This is not the substitution of the will of the judge for that of the legislator, for frequently words of general meaning are used in a statute, words broad enough to include an act in question, and yet a consideration of the whole legislation, or of the circumstances surrounding its enactment, or of the absurd results which follow from giving such broad meaning to the words, makes it unreasonable to believe that the legislator intended to include the particular act.”
The principle stated in Holy Trinity Church v. United States is referred to with approval in National Woodwork Manufacturers Ass’n v. National Labor Relations Board, supra. This court also referred to that case in Chang v. *401Meagher, supra, and stated: “While the most desirable construction of a statute is that which is consistent with the spirit and letter thereof, both of which should be considered, frequently the purpose of an Act justifies the departure from a literal construction of the wording.”
Earlier, this court stated in Rathburn v. Kaio, supra, that “if following the strict letter of a statute will lead to palpable injustice the courts search for a more reasonable meaning of the language which will also accord with the spirit of the enactment.” A recent pronouncement of this court on the subject is in Yoshizaki v. Hilo Hospital, supra, where it is stated: “We are aware of the many canons of construction which are supposed to aid a court in construing a statute. But we are also aware that for every construction exhorting a court to a literal interpretation of a statute there is a contrary one which justifies construction in a more liberal manner. A statute must be interpreted with a view to the problems with which it is intended to deal and not by reference to the too often vague concept of legislative intent.”
In construing a statutory provision similar to HRS § 578-2, courts are divided as to whether the consent of the natural father should be required when he marries the mother.
The following are some of the cases which have construed the statute literally and required the natural father’s consent: Warner v. Ward, 401 S.W.2d 62 (Ky. 1966); Sklaroff v. Stevens, 84 R.I. 1, 120 A.2d 694 (1956); Harmon v. D’Adamo, 195 Va. 125, 77 S.E.2d 318 (1953), and In re Adoption of Doe, 231 N.C. 1, 56 S.E.2d 8 (1949).
Among the cases which have construed the statute liberally in the light of the problem intended to be dealt with are: In re T., 95 N.J. Super. 228, 230 A.2d 526 (1967); In re Laws’ Adoption, 201 Cal. App. 2d 494, 20 Cal. Rptr. 64 (1962); In re Adoption of a Minor, 338 Mass. *402635, 156 N.E.2d 801 (1959); In re Adoption of Morrison, 260 Wis. 50, 49 N.W. 2d 759 (1951); In re Simaner’s Petition, 16 Ill. App. 2d 48, 147 N.E.2d 419 (1957).
The family court followed the latter group of cases and rightly so, in our opinion.
The rationale of the cases which have construed the statute liberally is best stated in In re T., supra, as follows : “It should be observed that plaintiffs were not married when the preliminary hearing approving defendant’s placement of the child was held in June 1965. This was the critical point in the entire sequence of events. Since the child had no legitimate father at that point in time, the subsequent marriage did not have the retroactive effect of making consent essential. To hold otherwise would run contrary to the policy manifest throughout the Adoption Act.”
Another statement of the rationale appears in In re Adoption of a Minor, supra, where it is stated: “At the time the mother’s consent was given she alone had authority to speak for the natural parents * * *, and did so. The father’s consent then was not necessary. * * * Her consent, conclusive when given, should be treated as binding on him as the other natural parent. Permission to withdraw that consent should be given by the probate judge only when the best, interests of the child so dictate.”
In re Adoption of a Minor was referred to in In re Laws’ Adoption, supra, where the court stated: “In effect, during illegitimacy, the natural mother acts in her own behalf and as the father’s agent in all matters affecting the child. Her agency is implied in law and extends to the transfer or renunciation of parental rights on his behalf as well as her own.”
The provision of HRS § 578-2 that “consent to adoption * * * may not be withdrawn or repudiated after the child has been placed for adoption, without the approval *403of the judge based upon a written finding that such action will be for the best interests of the child,” manifested the policy on adoption in this state that the crucial date for parental consent was the date on which the child was placed for adoption.
Richard D. Welsh (David N. Ingman with him on the brief) for appellants. Harold W. Nichelsen (Anthony B. Craven on the brief, Henshaw, Conroy & Hamilton of counsel) for appellee.In the light of such policy, the words “legal parents”, as used in HRS § 578-2, should be construed to mean persons who were legal parents at the time of placement of the child for adoption. To render such construction is within the legitimate functions of the judiciary, one of which is to fill a gap in the statute. Hayes v. Gill, 52 Haw. 251, 254, 473 P.2d 872, 875 (1970). A time limit beyond which a parent may not freely upset an adoption is essential to the integrity of the adoption process.
Affirmed.