THAYER, Circuit Judge,
after stating the case as above, delivered the opinion of the court.
The first question which confronts us in this case is one of jurisdiction. The appellants urge, and such is the fact, that they did not present their claim, which was secured by a mortgage or deed of trust, for allowance against the bankrupt’s estate; that the trustee in bankruptcy did not dispute the existence of the mortgage indebtedness; that the only real controversy which was tried and determined was that between the mortgagee and the mechanics’ lien holders concerning their respective priorities; and that, as this was a controversy in which the bankrupt’s estate was in no wise interested, the bankrupt court had no jurisdiction to determine it, and that the power to determine it could not be conferred by consent. It will be conceded that the authority to try the issue which arose between the lien claimants, and to determine their respective priorities, could only be exercised by the bankrupt court in virtue of the fact that by the proceeding in bankruptcy it had acquired the custody of the res to which the controversy related. The bankrupt court had no right to assume jurisdiction of a controversy between third parties, in which the trustee was not concerned, and decide whose claim was paramount in equity, merely because the claimants happened to be creditors of the bankrupt estate, or merely because the liens affected a part of the bankrupt’s property. The bankrupt act confers no such authority. But if, in the exercise of its customary jurisdiction, the bankrupt court obtained the lawful custody of the res to which the liens related or of a fund realized from its sale, then the duty which was thereby devolved upon it, of distributing the fund among those to whom it rightfully belonged, did empower it to determine the relative priorities of the conflicting claims to the fund. A court which has lawfully acquired the custody of property or money must of necessity dispose of the same according to law; and, when conflicting claims are preferred, it is not bound to" require the claimants to litigate their claims in some other forum, and to adopt the judgment of that tribunal, although it may do so, but it is at liberty to dispose of such controversies according to its own ideas of right and justice. This is one of those incidental powers which may be exercised by any court of record in the absence of an express prohibition. The jurisdictional question, therefore, resolves itself into an inquiry whether the bankrupt court acquired the lawful custody of the fund which was realized by the sale of the mortgaged property. The trustee in bankruptcy clearly had the power, acting under the directions of the bankrupt court, to sell the bankrupt’s equity of redemption in the mortgaged property. He would doubtless have discharged his full duty by praying for authority to sell simply the bankrupt’s equity of redemption. He saw fit, however, to ask for authority to sell the property free and clear of all liens, and in response [4]*4to such an application the mortgagees and the lien claimants appeared, and, without objecting to such order, agreed to submit their respective claims to the arbitrament and decision of the referee, and they further agreed that the sale as prayed for should be postponed until the priorities had been determined. It is obvious that there was no need of submitting and no propriety in submitting this question to the decision of the bankrupt court, unless it was for the purpose of laying the foundation for a proper distribution of the fund realized at the sale of the mortgaged property, after it had been sold free of all liens and incumbrances. Therefore the action that was taken by the appellants in this respect can be regarded in no other light than as a waiver of all objections on their part to a sale of the property free from incumbrances by the trustee in bankruptcy, and as a consent, voluntarily given, that such a sale might be made. It will not be presumed that the appellants and the appellees entered into a stipulation with intent to cast upon the bankrupt court the trial of a moot question, the decision whereof would be extrajudicial and binding upon no one. It must be presumed, on the contrary, that the parties entered into the stipulation aforesaid in good faith, with the understanding that the mortgaged property should be sold free of liens, and that the fund should be divided as the referee or the bankrupt court, after hearing the interventions, might direct. We are constrained to hold, therefore, that the parties in effect agreed that the property in question might be sold free and clear of all liens and incumbrances. This, we think, is the necessary construction which must be placed on the stipulation that was entered into before the referee. Such being the effect of the stipulation, it follows that in a controversy between a purchaser at said sale and these appellants the appellants would be estopped by their own acts from denying that the sale operated to discharge the lien of the mortgage and to transfer it to the fund realized at the sale, and we are of opinion that they cannot in this proceeding challenge the validity of the sale or deny that the proceeds of the sale came into the lawful custody of the trustee in bankruptcy and became subject to the disposition and control of the bankrupt court. The latter court, as we have already remarked, had the power to order the sale of the bankrupt’s equity of redemption. The provision that at the sale the property should be sold free of all existing liens was a provision which the appellants consented might be added to the terms of the proposed sale either for their own advantage or convenience; and, even if it should be conceded that under the present bankrupt act the bankrupt court had no power to prescribe this condition without the consent of the lienors, yet, having given such consent and taken part in a long trial to determine their respective priorities, they will not now be heard to complain of an order made, or of action taken, which, if in any respect erroneous, they themselves invited. We accordingly conclude that the lower court had the power, incidental to the right of disposition of a fund that had or would come lawfully into the custody of the trustee in bankruptcy, to determine how the fund should be divided among the rival claimants.
Under the old bankrupt law it was held that a court of bankruptcy [5]*5could direct a sale of mortgaged property owned by the bankrupt, devested of all liens, and could determine the priority of liens on the incumbered property, without the consent of the lienors and against their will. Ray v. Norseworthy, 23 Wall. 128, 135, 23 L. Ed. 116. It is denied by the appellants that any such power is conferred on courts of bankruptcy by the present bankrupt law because of the omission of those provisions from- which, under the old law, the authority in question was derived. But, in view of the fact that the sale in the case in hand was ordered by consent of all parties in interest, it is unnecessary, we think, to express a definite opinion with reference to the last-mentioned contention of the appellants, and none will be expressed at this time.
The only other question to be determined on this appeal is whether the lower court properly construed an act relating to mechanics’ liens which was adopted in the state of Arkansas on April 20, 1895. Acts Ark. 1895, p. 217. The question arises in the following manner: When Matthews, the bankrupt, made his application to the appellants for a loan to be secured by mortgage, he represented in his application that the money was borrowed to help build a building on the mortgaged premises, to be used by himself as a wholesale grocery establishment, and that the lot on which the building was to be erected was worth $2,500, and that the value of the building would be $5,500. The money, when advanced by the mortgagees in pursuance of this application, was transferred to their agent residing at Ft. Smith, Ark., who had negotiated the loan, the mortgagees being nonresidents. On receipt of the money this agent gave the mortgagor credit therefor on his books, and as the work progressed he paid $3,000 of the money thus advanced directly to contractors, laborers, and materialmen who were engaged in erecting the building on the mortgaged premises, but he permitted the residue of the fund, to wit, $1,000, to be expended for other purposes, and that amount never was in fact applied toward the erection of the building. The lien claims that are preferred by the appellees are in the main claims for materials supplied toward the erection of the building, all of which were so supplied subsequent to the execution of the appellants’ mortgage and the transfer of the fund to their agent. A part of the claim of one lienholder (H. I. Goddard) appears to be on account of services rendered in drawing plans and specifications for the building in question, the amounf of that item being $174.30. It may be that the lien for this item of his account had attached before the mortgage was executed, but as the lower court treated the whole of Goddard’s lien claim as being subsequent in point of time to the mortgage, and as Goddard did not appeal, and as the fund is probably adequate to pay Goddard’s claim in full, if the decree of the lower court was in other respects right, we shall proceed on the assumption that all of the mechanics’ liens became attached to the property subsequent to the execution of the mortgage, and shall dispose of the case on that assumption.
The lien law of the state of Arkansas that was enacted on April 20, 1895, supra, by its first section, gave to every mechanic, builder,o artisan, workman, laborer, or other person who should do or per-° [6]*6form any work upon, or furnish any materials, etc., for, any building, erection, or improvement upon land, or upon any boat or vessel, or for repairing- the same, under a contract with the owner thereof or his agent or. contractor, upon compliance with the provisions of the act, a lien upon such building, erection, or improvement, and upon the land belonging to such owner, on which the same was situated, to the extent of one acre; or, if the building was upon any lot of land in a town or city, then a lien was given upon the building or improvement, and upon the lot or lots of land upon which the same were situated.
The second section of the act defined the extent of the lien aforesaid, declaring, in substance, that the lien should only bind such right, title, and interest as the person contracting for the erection of the building or improvement possessed.
The third section of the act, over which the controversy in this instance arises, was as follows:
“The lien for the things aforesaid, or work, shall attach to the buildings, erections or other improvements, for which they were furnished or work was done, in preference to any prior lien or incumbrance or mortgage existing upon said land before said buildings, erections, improvements or machinery were erected or put thereon, and any person enforcing such lien may have such building, erection or improvement sold under execution, and the purchaser may remove the same within a reasonable time thereafter: provided, however that in all cases where said prior lien or incumbrance or mortgage was given or executed for the purpose of raising money or funds with which to make such erections, improvements or buildings, then said liens shall be prior to the lien given by this act.”
The fourth section of the act related to liens upon leasehold premises.
The fifth section of the act was as follows:
“The lien for work and materials as aforesaid shall be preferred to all other incumbrances which may be attached to or upon such building, bridges, boats or vessels or other improvements, or the ground, or either of them, subsequent to the commencement of such buildings or improvements.”
The sixth, seventh, eighth, and ninth sections of the act contained provisions relative to the steps to be taken by lien claimants to secure the benefits of the act. The provisions thereof have no special bearing upon the present controversy.
The tenth section of the act contained a provision, in substance, that any one ■ interested in buildings or grounds on which improvements were being made, “as mortgagee or trustee,” might at any time apply to the contractor or subcontractor for a list of all parties doing work or furnishing materials for such improvements, and for a statement of the amount due to each of such persons. It further declared that, if the contractor or subcontractor refused to give correct information on such points when it was applied for, he should be guilty of a misdemeanor, and punished by a fine not exceeding $500. The remaining provisions of the act have ho special bearing upon the existing controversy.
On this state of facts, the question arose in the lower court whether, as respects the $1,000 of the mortgage indebtedness that had not been applied by the mortgagees’ agent towards the erection of the [7]*7building on the demised premises, but had been expended for other purposes, the mortgagees were entitled, by virtue of the proviso to section 3 of the mechanics’ lien law, supra, to priority of payment over the mechanics’ lien claimants. The lower court, in an able and carefully prepared opinion (reported in Re Matthews, 109 Fed. 603, 6x0), decided this question in the negative, holding, in substance, that when a person advances money, taking security therefor in the form of a mortgage, which was borrowed by the mortgagor for the professed purpose of erecting a building or improvements on the mortgaged premises, he can claim no priority of lien over persons who have performed labor or furnished materials for the erection of such building or improvements subsequent to the execution of the mortgage, except for such part of the money so advanced by the mortgagee as was actually expended in the erection of such building or improvement. The majority of the members of this court are of opinion that the conclusion reached by the learned judge of the lower court was right, and that it should be affirmed. The lien law in question is a remedial statute. It was enacted to secure to laborers, artisans, and others who perform labor or furnish materials for the erection of buildings on the land of others, payment for such services and materials, by giving them a lien on the structures which they have helped to create, instead of compelling them to rely merely on the personal security of the debtor. That such laws are fair and just, and that they also tend to encourage the erection of buildings by insuring payment for the labor and materials that are expended in their erection, has been generally recognized. Davis v. Bilsland, 18 Wall. 659, 661, 21 L. Ed. 969. As such laws are remedial in their nature and are prompted by a wise policy, they should be liberally construed in favor of the class of persons for whose benefit they were intended.
The first section of the act now under consideration declares that those who do work or furnish materials for the erection of an improvement on land- shall be entitled to a lien therefor on the land and the improvement. This is a general rule applicable to all cases, and the burden is upon one who disputes the existence of a lien for work done or materials furnished for the purpose aforesaid to make good such contention. Section 3 of the act deals with the subject of priorities, when there are other'liens of a different character, the rule prescribed being that, in so far as the improvement is concerned, mechanics’ liens shall be preferred over all liens existing on the land even before the improvements were erected, and that they may be sold and removed for the benefit of the laborer and material-man. Then follows the proviso that when a prior lien, by way of mortgage, is given for the purpose of raising money to erect improvements, it shall be entitled to priority. In framing this section of the act the legislature evidently had in mind the comparative equities of one who supplies labor or material for improvements on land- and one who furnishes money which is actually expended for the erection of such improvements. These equities were regarded as being equal; hence the proviso declared, in substance, that the lien which was prior in point of time should be preferred. That [8]*8portion of the section, however, which precedes the proviso, clearly recognizes the fact that the equity of one who simply loans money secured by a mortgage on land, which is not used to improve it, is inferior to that of a materialman or laborer who subsequently contributes to the erection of improvements on the land under a contract with the owner, thereby enhancing its value; and the latter lien, as respects the improvement, is preferred. We are constrained to believe that the legislature did not intend to prefer the lien of the mortgagee over that of a laborer or materialman when the former loans his money on the representation that it is borrowed for the purpose of improving the mortgaged property, unless it is in fact expended for that purpose. The contrary view of the statute, that the mere expression by the mortgagor of a purpose to use the money borrowed to improve the mortgaged premises entitles the mortgagee to a preference, would, in effect, nullify that part of section 3 which precedes the proviso, as is very clearly shown in the opinion of the lower court (109 Fed. 311, 312); for, as the proviso does not specify any time, prior to the commencement of an improvement, within which the money must be loaned by the mortgagee, it follows that if it is loaned years before the improvement is commenced, and not a dollar enters into the improvement, nevertheless the mortgagee may successfully assert his priority on the ground that when the loan was made the mortgagor represented that it was to be used for the purpose specified in the proviso. This seems to be a very unreasonable interpretation of the statute, and one that would enable a mortgagee to defeat an equity which the statute clearly recognizes as superior, and an equity which it was designed to protect. Such an interpretation of the statute can hardly be supposed to have been within the contemplation of the lawmaker, when we reflect that the general purpose of the act was to afford greater security to laborers and materialmen, and to restrict, in a measure, the rights of other lienholders. The lien law in question was framed, we think, with reference to the known habits of men who loan money on the security of real estate, with the understanding that it is to be used to enhance its value by improving it. In such cases, as the' legislature well knew, the lender usually sees to it that the money is used as the borrower promised to use it. The mortgagees did so in the case in hand; they evidently construed the statute as we construe it; they paid the money, not to the mortgagor to be expended as he thought best, but to laborers and materialmen, except the sum of $1,000, which amount the mortgagor managed to obtain and used for a different purpose. Therefore, when the proviso gives a preference to mortgagees if they loan money for the purpose of improving mortgaged property, it refers to an executed purpose, and not merely to a purpose expressed by the mortgagor at the time of the loan, which is not carried into effect. If the purpose of the loan is not consummated, the equity of the lender is inferior to that of a mechanic’s lien holder.
This view of the statute is confirmed by the tenth section of thé act, the substance of which is stated above. By that section the mortgagee is given power to call upon contractors for the erection of an [9]*9improvement, at any time, for the names of all materialmen and laborers and the amount due to each, and the contractor is required, under a heavy penalty, to give correct information; the evident purpose of this provision being to enable the mortgagee to expend the money which he loans, exclusively for the payment of such bills. But the act contains no corresponding provision enabling a material-' man or a laborer to call upon a mortgagee for information concerning the purpose for which the money secured by his mortgage was loaned and compelling the latter to give such information. He can keep his own counsel, stand by and see materialmen and laborers expend their substance in making the mortgaged property more valuable, and then come forward and assert that by virtue of an oral representation made by the borrower, which was known only to himself, he is entitled to priority. We are of opinion that the legislature did not intend to place laborers and materialmen in that situation.
We are aware that some courts have at times expressed, in strong terms; the necessity of reading and enforcing statutes literally without regard to consequences. Some of these utterances have been called to our attention. But this doctrine of literalism which clings to the letter of a statute and ignores its purpose is not well calculated to promote the ends of-justice, and has not been viewed with favor, at least by the federal courts. It is not the duty of a court of justice to perpetuate mistakes inadvertently made by the lawmaker by a blind adherence to the letter of a law, when the purpose of the law is apparent. A legislative enactment should always be so construed as to give effect to the. intention of the lawmaker, when it is discernible, even if the language employed to express the intent is in some respects inapt and faulty. This is the primary canon of construction, which dominates all others, inasmuch as construction consists solely in finding out the intent of the lawmaker, with the aid of all such light on the subject as can be obtained. Legislative bodies are not always fortunate in the use of language, but, if careful attention is paid to all the provisions of a statute as well as to the conditions which led to its enactment, little difficulty will generally be experienced in ascertaining what was intended. When the purpose is discovered it should be given effect, since whatever is within the intention of the lawmaker is as much within the statute as if it was within the letter. U. S. v. Freeman, 3 How. 556, 565, 11 L. Ed. 724; U. S. v. Babbitt, 1 Black, 55, 61, 17 L. Ed. 94. It sometimes happens that the language employed in one paragraph of a statute acquires a new meaning that no one can dispute when read in connection with other provisions of the act, or in connection with prior legislation on the same or a cognate subject, or in the light of the end to be accomplished or the circumstances that gave birth to the enactment. In interpreting and enforcing a statute, therefore, no court should overlook these means of information merely out of deference to particular words of the act which, through haste or inadvertence, may not fully or accurately express its true purpose. Nor are the courts in the habit of giving effect to laws strictly according to the letter, ignoring all other considerations. They will sometimes supply exceptions to a general rule, where none is expressed, as in Hanger v. Abbott, [10]*106 Wall. 532, 18 L. Ed. 939, where an exception was implied, although none was expressed, thereby taking a case out of the operation of the statute of limitations. In like manner they will supply words where they seem to have been unintentionally omitted, as in Kennedy v. Gibson, 8 Wall. 498, 506, 19 L. Ed. 476, where the word “by” was supplied so as to permit actions in the federal courts to be brought “by” national banks as well as “against” them. Previous legislative enactments and definitions of terms therein contained that have been repealed may also be consulted for the purpose of ascertaining what is meant by like terms as used in subsequent enactments. Ex parte Crow Dog, 109 U. S. 556, 3 Sup. Ct. 396, 27 L. Ed. 1030. And where, by certain clauses of a statute relating to the removal of cases to the federal court, the right had been confined to nonresident defendants, thereby establishing a legislative policy on the subject, it was held by this court that the same restriction would be implied in another clause of the act, although it was not in terms expressed. Thurber v. Miller, 14 C. C. A. 432, 67 Fed. 371. The decisions in Fisk v. Henarie, 142 U. S. 459, 12 Sup. Ct. 207, 35 L. Ed. 1080, and McDonnell v. Jordan, 178 U. S. 229, 20 Sup. Ct. 886, 44 L. Ed. 1048, also' illustrate in a striking manner to what extent the express words of a statute will be ignored when it is deemed necessary to do so to give effect to the legislative purpose. In those cases the court was dealing with the second section of the judiciary act of 1887 (25 Stat. 433, 435, c. 866), which permits the removal of causes from the state to the federal court on the ground of prejudice or local influence “at any time before the trial thereof.” Notwithstanding the use of the latter words, the supreme court decided, basing its ruling on previous legislation and also on the general purpose of the act to restrict jurisdiction of the federal courts, that cases could not be removed on the ground of prejudice and local influence unless the removal was applied for, not as the words of the act declared, “at any time before the trial,” but only in the event that the application for a removal was made before or at the term at which the cause could be first tried. In the case of United States v. Southern Pac. R. Co., 184 U. S. 49, 56, 57, 22 Sup. Ct. 285, 46 L. Ed. 425, the supreme court further enforced the doctrine, quoting with approval a paragraph from Potter, Dwar. 231, that a court should always so construe a remedial statute as to give effect to the intent of the lawmaker, even if in doing so it is necessary to go beyond the letter of the statute. Indeed, it may be stated generally that no inaccuracy in the use of language, or grammatical errors, or the omission of words or phrases, or the use of the wrong word, will serve to defeat the intent of the lawmaker when the intent can be definitely ascertained. Bish. Cont. § 383.
Without pursuing the subject at greater length, it will suffice to say that, after a careful study of the lien law in question, we are of opinion that it was not the intention of the legislature to give mortgagees a preference over the holders of mechanics’ liens whose liens are. subsequent in point of time, unless the money which they advance is actually expended in the erection of the improvement to which the controversy relates. A mortgagee • who does not see to it that the. [11]*11money advanced is thus expended is in no better situation than one who loans money without any representation on the part of the borrower respecting the use that will be made of it.
With respect to the claim of Dyke Bros., the lower court found that they had furnished materials for the erection of the building in question on the representation of the mortgagees’ agent that he had $1,500 of the mortgagees’ money still in his hands unexpended, and that he would see that they were paid for the materials which they supplied out of that fund. For this reason its order of distribution, as heretofore stated, directed that Dyke Bros, should be paid, in preference to the mortgagees, out of the proceeds realized from the sale of the mortgaged property. This finding by the lower court js amply sustained by the testimony, and we would not be warranted in finding to the contrary upon the evidence contained in the present record. Moreover, as the order which was made by the lower court for the distribution of the fund will avoid circuity of action and discharge an obligation to pay the claim of Dyke Bros., which the mortgagees by their agent (to whom the mortgage, as it seems, has now been assigned) assumed, we think that the order, in so far as it concerns the claim of Dyke Bros., should not be disturbed, even if it be true that the facts as found by the trial court are not sufficient to estop the appellants from asserting the priority of their mortgage lien. The facts as found by the lower court do show that the mortgagees are bound to see that the claim of Dyke Bros, is paid in full, and the order accomplishes that object without the necessity of further litigation.
In framing the order for the distribution of the fund, the lower court seems to have overlooked the fact that the third section of the mechanics’ lien law, to which the present discussion relates, gives to laborers and materialmen a preference over a prior incumbrance only as respects the improvements that are erected and not as respects the land. It may be that the sale will produce enough to discharge all the liens, and it may be that the circumstance last mentioned, though fully understood by the trial court, was not regarded as of any special importance for that reason. If enough will not be realized from the sale to discharge the mortgage in full according to the priorities as they have been declared, then the order of distribution as made should be modified so as to secure to the mortgagees, except as to Dyke Bros., their priority as respects the land. Possibly it may be necessary, before the sale, to ascertain the comparative value of the land and improvements as a means of determining the sum realized from each. If such a course is found to be necessary, the sum realized from' the land should be applied pro rata so as to reduce that part of the mortgage debt amounting to $3,000, which is •entitled to priority, as respects the improvements, as well as that part of the mortgage debt, to wit, $1,000, which is not entitled to such priority. If the fund is adequate to pay all the liens, no comparative valuation of the land and improvements would seem to be necessary, as no one will be injured by the enforcement of the existing order.
Finding no other error in the order, it will be affirmed except in the respect last mentioned, and the record will be remitted to the [12]*12lower court, with directions to modify its decree as herein explained, if it shall be found necessary to do so for the preservation of the full rights of the appellants.