Relators presented their petition averring that Jacob Henry Fulkroad, a child now less than two years of age, was illegally restrained of his liberty by respondents, his maternal *356grandparents, and praying for the issuance of a writ of habeas corpus commanding respondents to produce the child before the judge to whom the petition was addressed and to show cause why he should not be delivered into the custody of his father, Henry A. Fulkroad. On April 4, 1938, the writ was directed to issue and April 16, 1938, 10 a.m., was fixed as the time for the hearing, to be held at the courthouse. The sheriff made return of personal service of the writ upon both respondents, who appeared in person at the time and place of hearing, bringing with them the child Jacob. They were without counsel, and at their request the hearing was postponed to April 25th, the first day of the April term of court. At this time they again appeared with the child and were represented by counsel. The latter immediately presented a writing in which he stated that he appeared de bene esse for «the respondents and moved the court to quash the writ of habeas corpus, “for the reason that the Court of Quarter Sessions of the Peace for the County of Juniata has not jurisdiction”. The court overruled the motion and directed, over the objection of respondents’ counsel, that the testimony be heard. Counsel for relators then moved to amend the petition to bring it into the common pleas, and that the writ be certified into that court. This motion was held under advisement and the testimony was then taken, a number of witnesses being heard on each side.
The petition was styled, “In the Court of Quarter Sessions of the Peace for the County of Juniata”, and was addressed to the president judge of that court, instead of to a judge of the common pleas, as directed by the Habeas Corpus Act of February 18, 1785, 2 Sm. L. 275. It was explained that this inadvertence arose from the suggestion of a form apparently appropriate only for practice in Philadelphia County under the Act of April 4, 1837, P. L. 377, sec. 2. But through another error the officer who issued the writ made it returnable before “one of *357the judges of our court of common pleas of said county”. It was issued over the name of the “president of our said court”, and was attested by the officer as “prothonotary”, not as clerk of the quarter sessions court, although he held both offices.
To quash the writ on the ground set forth in the motion would involve the expense and delay of a second petition, writ, and service, and a second hearing, upon the same evidence and before the same judges, for the sole purpose of changing the words “quarter sessions” in the petition to “common pleas”. We think this is unnecessary. The present writ is in proper form, was issued from the-proper court, and it was the writ, not the petition, which they never saw, that brought the respondents into court.
“The function of a petition or affidavit for a writ of habeas corpus is to secure the issuance of the writ, and when that is issued, the petition or affidavit has accomplished its purpose”: 29 C. J. 142, sec. 156.
“Mr. Church, however, in his work on Habeas Corpus (§156, p. 241), states that a motion was made to quash the writ, on the ground that it had been issued improvidently, before Justice Wilson, of the Queen’s Bench, in Canada, and the justice stated: ‘Even if it were clear to me that I have the power, I do not know that I would exercise it, now that the writ has been returned and filed, and the prisoner is here awaiting my judgment.’ See In re Ross, 3 P. R. (Can.) 301. So, states the author, instead of quashing the writ on motion made for that purpose, he discharged the prisoner on defects in the warrant returned. This practice commends itself very strongly to our minds. When the writ has been answered, and the prisoner produced, why fritter away his rights with technical niceties and rules of pleading? Let it be granted that the writ ought not to be issued until probable cause is shown, when it is issued, even though improvidently, if it accomplishes its purpose and results in the production of the person detained, why remand to the place whence *358he came a man deprived of his liberty without any color of legal authority, because, forsooth, the petition is defective in form or even in substance? The writ of habeas corpus is a writ of right, and its beneficent effects ought not to be dissipated by subtle objections and technical niceties”: Simmons v. Georgia Iron & Coal Co., 117 Ga. 305, 312, 61 L. R. A. 739.
The procedure in the present case is manifestly irregular, but the irregularity has harmed no one. The case is now before the same court, in precisely the same form, as if the preliminaries had been entirely regular. To correct this irregularity by the drastic means of quashing the writ, with the resulting delay and expense, would profit no one. The record may be brought into order by allowing the motion to amend the petition by substituting the words “common pleas” for the words “quarter sessions”, wherever the latter occur, and by directing that the entire record be transferred from the quarter sessions to the common pleas court and that it be given its proper number and term and be duly indexed and noted on the appearance docket in the latter court.
A discussion of the evidence would serve no useful purpose. It is sufficient to say that the three judges who heard the case are unanimous in the opinion that the best interests of the child will be promoted by restoring him to the custody of his father, to whom the right of such custody presumably belongs.
And now, May 13, 1938, it is ordered and decreed:
That the petition for the writ of habeas corpus be amended by substituting the words “common pleas” for the words “quarter sessions”, wherever the latter occur.
That the entire record be transferred from the court of quarter sessions to the court of common pleas and that it be assigned its proper number and term and be duly indexed and noted on the appearance docket in the latter court.
*359That respondents, W. H. Creider and Bertha Creider, his wife, forthwith surrender and deliver the child, Jacob Henry Fulkroad, into the custody of his father, Henry A. Fulkroad, relator.
That the costs of this proceeding, including the fees of witnesses for the Commonwealth and the costs of their summoning, be paid by the County of Juniata.