
    S. J. Beach and Charles L. Weld, Partners Under the Firm name of Beach & Weld, Appellee, v. E. C. Wakefield et al., Appellee, Warwick Hough, Receiver of the Sioux City Terminal Railroad and Warehouse Company, Appellant, and the Trust Company of North America, Appellant, et al.
    
    , 13 Admission: pleadings. The owner of a mechanic’s lien is, on appeal, entitled to the benefit of an admission as to the amount of his lien by a party to an action in which the foreclosure of the lien is sought, notwithstanding that the admission was the result of inadvertence.
    1 7 Railroads: bonds. A terminal railroad and warehouse company, the purpose of which as stated in its articles of incorporation, is the construction, maintenance and operation of one or more lines of railway within the corporate limits of a city, with all necessary side tracks, depot, yards, warehouse, storage house, elevators, and all other terminal facilities, is a railroad corporation within McClain’s Code, section 1965, authorizing railroad corporations to mortgage their property, including their franchises.
    9 Statutes. Code, 1873, section 1061, limits the amount of indebtedness of corporations for pecuniary profit to two-thirds of their capital stock. Acts Twentieth General Assembly, chapter 22, provided that such statute should not apply to railroad companies’ bonds issued to a stated amount per mile of track. Acts Twenty-first General Assembly, chapter 57, made inapplicable to bonds or debentures of any corporation secured by actual transfer of real estate securities of equal value, which securities were first liens on lands of double their face value. Reid, that the latter proviso was applicable only to a special class of investment companies, and that the said provisos did not take out of the statute a terminal railway company which executed bonds and a mortgage on its property exceeding in amount two-thirds of its capital stock.
    8 Mortgages. The power conferred upon railroad companies by McClain’s Code, section 1965, to mortgage their property would imply authority to mortgage after acquired property in the absence of section 1966, expressly authorizing the mortgaging of after acquired property.
    3 4 6 Mortgagor: bight to attack settlement by debior. A mortgagee may complain of a fraudulent settlement between the mortgagor and the holder of a mechanic’s lien paramount to the mortgage whereby the amount of the lien is fixed at a sum in excess of that actually due.
    3 4 Kule applied. The balance due on the contract price of a building, a payment made by the contractor for the account of the owner, and an allowance for extra work to the contractor aggregated $' 7,500. The contractor claimed a mechanic’s lien for $51,000 and interest, the basis of which was a settlement with the owners’ president. The items of the settlement were not in the record, but the president testified, in effect, that such settlement was made, not on the amount actually due, but as a matter of policy, to conciliate certain interests, in a sum large enough to cover all of the subcontractors claims, expecting that the second mortgagees of the corporation’s property would make good the increased amount. Held, that the amount for which the lien might be enforced was $17,500.
    4 Same. The president of a terminal railway and depot corporation has no implied power to make a settlement with a building contractor in a sum larger than the amount actually due so as to cover subcontractor’s claims, and thereby conciliate certain interests, in order to secure concessions to the corporations, where such settlement operates to create a lien which impairs the securities of junior lien holders, in the expectation that they will make good the over-allowance.
    10 11 Corporations: estoppel. A railway corporation, though quasi-pub-lie in character, is not exempt from the rule that forbids a corporation which has received the full benefit of a loan from avoiding its liability therefor by reason of a statute limiting the amount of indebtedness which corporations of its class may incur.
    10 Same. Where a corporation has exceeded the statutory limit of' indebtedness and had executed a mortgage on its property to secure the debt, which was not in itself opposed to public policy, ne'ther the corporation, which was insolvent, nor any creditor or incumbrancer whose rights accrued subsequent to such mortgage, and with notice thereof, has any standing to question its validity on that ground.
    
      10 Same. Where a corporation exceeded the limit o'f its indebtedness by an issue of bonds and a mortgage to secure them, which indebtedness was voidable only, a bondholder and mortgagee is not preeluded from pleading estoppel against the corporation and its subsequent creditors and lienors attacking the validity of the mortgage] because of the mortgagee’s constructive notice of limitation of the corporation’s authority.
    12 Same. Where a corporation received the proceeds of a bond issue, and secured the bónds by a mortgage of its property, it cannot attack the mortgage as being materially different in form from that authorized by the directors, since, if originally unauthorized, the corporation’s act amounted to a ratification.
    7 Mechanic's Lien: railroads, A builder constructing a union depot for a terminal railway- and warehouse corporation, which was a / railroad within the statute, and where the building of such depot was the real and primary purpose of the corporation’s organization, has a mechanic’s lien on the corporation’s entire railroad property, prior to incumbrances and liens accruing subsequent to the beginning of the work-
    14 Bights of owner on breach of contract. An owner, who, on the default of a building contractor completes the work, under the provisions of the contract permitting him to do so, and to deduct the cost from the amount due the contractor, has the same right to reimburse himself out of the amount reserved during the progress of the work by the contractor against the holders of mechanic’s liens as against the contractor himself.
    5 Waiver. ’ A party who permitted the introduction, without objection, under a general denial, of evidence relevant to an issue of fraud, which was not averred, is deemed to have consented to the trial of that issue, since the rule of pleading which requires fraud to be averred may be waived.
    3 3 Payment: Btj aocepUmee of order. Where a building contractor gave his subcontractor an order on the owner for the amount due the subcontractor, which order was expressed to be in full settlement, and was accepted by said owner, it operated as a payment.
    2 3 Same. A subcontractor’s right to a mechanic’s lien is not extinguished ■ by his taking in payment of his claim against the contractor an accepted order drawn by the contractor on the owner which order is not paid.
    7 Adjudication, following federal court decision. Where a mortgagee has on account of interest in the subject matter of the action, been permitted to attack rights of mechanic’s lienors on the same property, and the validity of the mortgage is denied, the court will determine that question, as between the mechanic’s lienor, said mortgagee and junior mortgagee, notwithstanding it has already been adjudicated in a foreclosure suit brought by said mortgagee in the federal court, where tire latter is still pending on- appeal.
    
      
      Appeal from Woodbury District Court. — TIon. E. R. Gay-nor, Judge.
    Tuesday, October 11, 1898.
    
      Supplemental Opinion February 7, 1897.
    
    Ti-iese proceedings had their inception in an action by plaintiff firm to establish and foreclose a mechanic’s lien. The claim is that defendant Wakefield was the principal contractor for the erection of a depot building for the Sioux City Terminal Railroad & Warehouse Company, and that plaintiff, as a sub-contractor, furnished material for such building; and the prayer is that a lien be established upon the real estate whereon said depot is located, and that a decree be given foreclosing the same. Wakefield filed an answer and cross petition. ITe denies the amount of plaintiff’s claim, but admits the sum of two thousand one hundred and eighty-seven dollars and forty-seven cents is due. ITe also seeks to establish a mechanic’s lien, and avers that his lien, which he claims upon much other real estate besides that upon which the depot is located, is superior to that of any of the other parties hereto. Continuing, Wakefield alleges his contract with the Terminal Company for the erection of a depot building.' ITe claims there is due him under said contract, and for extras, and by agreement and final settlement the sum of fifty-one thousand and ten dollars and eighty-four cents; and for this amount he prays his lien be established. This cross-petition is amended in certain particulars, which need not be here set out. It is well, perhaps, to state that the various parties hereto were made defendants in this pleading. There were many parties who filed answers and cross^petitions. We need concern ourselves here with but two of them, — the Terminal Company and the Trust Company of North America. There are some special issues, which we shall set out in the course of the opinion; but most of the other parties are sub-contractors, who are seeking to enforce their liens, and there is nothing of particular importance in tbe pleadings they have filed. Tbe substituted answer of the Terminal Company is a general denial of tbe allegations of tbe petition and of all cross-petitions. Tbe Trust Company of North America (wbicb we shall hereafter dsignate as tbe “Trust Company”) puts in issue, by a denial, tbe various affirmative allegations made against it in tbe pleadings of tbe other parties, and sets up a mortgage for tbe sum of one million two hundred and fifty thousand dollars, wbicb it seeks to have declared a first lien •on tbe Terminal property. This, perhaps, is sufficient as a •statement of tbe case. When it is said that the pleadings and .exhibits fill one hundred closely-printed pages of tbe abstract, it will be seen that some condensation is necessary. Tbe decree of tbe district court established tbe lien of Wakefield in tbe sum of fifty-nine thousand six hundred and eighty-two dollars and sixty-eight cents, yith' interest at six per cent, from August 3, 1896, for tbe benefit of himself and bis subcontractors, tbe amount and order of whose liens are fixed in tbe decree, including tbe Gillette-Iierzog Company, in tbe amount of fifteen thousand four hundred and six dollars and eighty-nine cents. Tbe Trust Company is given a lien under its mortgage for one million two' hundred and fifty thousand dollars, with interest, but it is expressly made subordinate to tbe mechanics’ liens. Hubbard, trustee, is also' found entitled to a lien in tbe sum of seven hundred and eighteen thousand dollars and interest. Tbe Hubbard lien is, however, postponed to that of Wakefield, and also to' that of tbe Trust Company. The Trust Company appeals from tbe decree in so far as it fixes thfe amount of tbe mechanics’ liens, and establishes tbe mortgage lien as inferior thereto'. Wakefield, Hubbard (as trustee and as assignee), Hough (receiver), tbe Terminal Company, tbe Credits Commutation Company, Spalding, and others appeal. Tbe details of their respective complaints will be stated in tbe opinion; that is, so far as they have been urged in this court.
    
    Modified and Affirmed.
    
    
      
      A. F. Gall for appellant Trust Company of North America.
    
      Wright & Hubbard for appellant Warwick TIough.
    
      Swan, Lawrence & Swan for appellees Beach & Weld.
    
      Taylor & Burgess, Argo, McDuffie & Argo, Carter & Brown, J. O’Donovan Rossa, Strong & Owen, Lynn & Foley, Marsh & Henderson, Maries & Mould, F. F. Gill, T. P. Murphy, Henderson, Hurd & Kiesel, and Chase & Dicleson for appellees E. C. Wakefield and others.
   Waterman, J.

The Sioux City Terminal Railroad & Warehouse Company was organized and duly incorporated under the laws of this state. The purpose of its organization, as stated in the articles of incorporation, was to construct, operate, and maintain one or more lines of railway within the corporate limits of Sioux City, Iowa, with all needed side tracks, depot yards, warehouses, storage houses, elevators, and all other needed terminal facilities; and shall have power to acquire by purchase or condemnation all needed grounds for right of way, depot purposes, and side tracks, wood and water stations, and to hold, use, and control the same; and shall have power to' construct, operate, and control one or more lines of railway from the depot and yards of ■said company in Sioux City, — one to run in an easterly direction to the east line of Woodbury county, Iowa, one to run in a westerly direction to the Big Sioux river, and one in a northerly direction to the Iowa state line; and shall have power to lease grounds and buildings, to purchase and hold all needed grounds for the use and purpose of said company, and to mortgage, lease, or sell the said grounds, and improvements thereon.” Proceeding to' carry out this plan, a contract was made with Wakefield to erect for it a passenger station and train sheds, and the various controversies here grow out of that undertaking.

I. The GilletttedEEerzog Company was a sub-contractor under Wakefield. It filed a cross-petition in this action, claiming to be a creditor of Wakefield, and asked a judgment against him for the sum of twelve thousand eight hundred and forty-five dollars and ninety-one cents and interest, and for the establishment and foreclosure of a mechanic’s lien against a part of the Terminal property. This relief was granted, and complaint is made by Wakefield of this action of the trial court. It seems that in April, 1893, Wakefield gave said company the following written order on the Terminal Company, the amount named therein being the full sum due on its contract:

“April 1, 1893. Messrs. The Sioux City Terminal Railroad & Warehouse Company, Sioux City, Iowa — Gentler men: Please pay to the order of the GilletteTTerzog Manufacturing Company $23,190 36-100 (twenty-three thousand one hundred and ninety and.36-100 dollars), in full settlement of my note for $10,000.00, and of their account for material furnished and labor performed'in connection with the structure ironwork for your depot and train shed. E. C. Wakefield.
“This note accepted April 1. George Walter Oakley, Treasurer.”

As appears upon its face, t-his order was accepted by the drawee. Shortly after this transaction the Terminal Company paid the sum of ten thousand dollars' on this order, and later gave the Gillette Company a check for five thousand seven hundred and twenty-two dollars and ninety-four cents, the same being drawn on the Trust Company of North America. This check was not honored. A certain reduction in the amount of the Gillette Company’s claim was afterwards made on account of freight charges paid by Wakefield. We do not discover that the amount found due on this claim is questioned, but it is said that the order on the Terminal Company was given by Wakefield and accepted by the Gillette Company in full satisfaction and payment of the latter’s account. The rule is that the giving of an order on a third person will operate as payment of a precedent debt, if there is an express agreement to that effect. Farwell v. Salpaugh, 32 Iowa, 582; Huse v. McDaniel, 33 Iowa, 406; 2 Daniel Negotiable Instruments, 1262. There is evidence showing that at the time this order was given the parties spoke of it as being in settlement and full satisfaction of the account, and that the Gillette Company afterwards asserted that it had no claim against Wakefield. This evidence is uncontradicted. Indeed, counsel for the Gillette Company does not seriously contend that this was not payment. His main effort to sustain the finding of the lower court is grounded upon the claim that the order operated as an assignment of the fund, and that a right to a lien passed by the assignment. Under our finding of fact that the acceptance of the order was a payment of the claim as far as Wake-field is concerned, it is manifest that the Gillette Company is not entitled to a personal judgment against him, and it is insisted by counsel who resist this claim that it has no right to a mechanic’s lien. The claim of an equitable assignment of Wakefield’s right is met with the assertion that it is only the perfected lien that is assignable, and not a mere inchoate right to a lien. We have quite lately held that the right to a lien is assignable before the statement therefor is filed, if the parties so intend. Peatman v. Power Co., 105 Iowa, 1. But, as we see this ease, that question is not involved. The Gillette Company is not claiming Wakefield’s right tO' a lien through an assignment, but its own right based on its claim as a sub-contractor. The real question is, has it lost the right which it admittedly once had ? Wakefield has paid it, so far as he is concerned, by giving an order on the owner; that is, he has canceled his personal liability. But we hardly think this transaction can stand in the way of an enforcement of the sub-contractor’s rights against the property. A sub-contractor, it is true, cannot enforce his lien against the owner until his account against the principal contractor has been established or adjudicated. Simonson Bros. Mfg. Co. v. Citizens’ State Bank, 105 Iowa, 264; Vreeland v. Ellsworth, 71 Iowa, 347. And it has been held that the right of a laborer or sub-contractor must be enforced through his employer or principal. Utter v. Crane, 37 Iowa, 631. This last case is thought to be decisive against the claim of the Gillette Company to a lien. All that was decided in the Utter Case was that a laborer had no right agaipst the principal contractor when the sub-contractor by whom such laborer was employed had been paid in full according to the terms of his contract. In the case at bar the amount of the claim against the principal contractor has been settled by the agreement, and the Gillette Company is seeking its rights through Wakefield, though not necessarily against him. The giving and receiving of this order amounted to no more than an agreed statement of the amount of the Gillette Company’s claim, and its acceptance by the Terminal Company was but a recognition of this fact, and a promise to pay. We are at a loss to see how this transaction deprived the sub-contractor of its light to a lien. In addition to what has been said, we may add that the amount for which Wakefield is claiming a lien seems to include the Gillette Company’s account. The decree of the trial court fixes the order of priority of the mechanics’ liens, and the Gillette Company is ranked No. 13. Counsel insist here that it should have the second place. No reason is given in support of this claim, and we are unable to find any in the record. We do find, however, that it is entitled to the eleventh place in the list.

II. The next two questions that arise are intimately connected: (1) For what amount should Wakefield be allowed a lien? It is not disputed that he is entitled to a lien for some amount, but it is most earnestly insisted on behalf of the Trust Company that the trial court allowed him far more than was due. (2) The next question is one of priority, and arises between Wakefield and those claiming rights under the trust deed to the Trust Company of North America. We shall take these matters up in the order stated.

6 Wakefield was awarded a judgment for fifty-nine thousand six hundred and eighty-two dollars and sixty-eight cents. This amount seems to have been allowed on the strength of a settlement and adjustment of the account had by Wakefield with A. S. Garretson, the president and active manager of the Terminal Company. More will be said of this alleged settlement later. We only wish to say at this time that the items are not given in the record, from which the amount so allowed can be made up. It is undisputed, however, that Garretson allowed Wakefield’s account in the sum of fifty-one thousand ten dollars and eighty-four cents. This, with interest thereon, would make up the amount awarded by the trial court. We shall now go to the record, and see how Wakefield’s account stands according to the figures there appearing. The contract price for the depot building was one hundred and thirty-five thousand six hundred and fifty-six dollars. Before its completion, Wakefield abandoned the work, and the structure was finished by the Terminal Company at a cost of twenty-one thousand two hundred and ninety-seven dollars and seventy cents. This would leave a net sum due the contractor of one hundred and fourteen thousand three hundred and fifty-eight dollars and thirty cents. Of this amount, one hundred and five thousand eight hundred and thirty-seven dollars and twenty-five cents was paid him during the progress of the work, leaving still due of the contract price eight thousand five hundred and twenty-one dollars and five cents. These amounts are not disputed, save that paid for completing the building. As to this, we think the figures given are sustained by the testimony. In addition to this, Wakefield had a claim for extra work done. He-says now that this was sufficient in amount to increase his account to the sum allowed in the settlement. On April 25,. 1893, he filed a claim for a mechanic’s lien, in which he set forth the extra work as of the value of seven thousand four' hundred and sixty-eight dollars. Again, we find in the record" that in September, 1893, Wakefield submitted to the architects of the building, who had a right of supervision and decision of such matters under the building contract, his claim for extras, fixing the amount at eight thousand seven hundred and ninety-two dollars and seven cents. This was allowed by them in the sum of seven thousand two hundred and fifty-four dollars and eighty-two cents. No objection seems to have been made to this allowance, and we are inclined to accept it as correct. There is also an amount of one thousand seven hundred dollars, which was charged to Wakefield, but which, although received by him, was, at the request of the Terminal Company turned over to the architects. ITis account should be increased to this extent. We have, then, the architect’s allowance for extras, seven thousand two hundred and fifty-four dollars and eighty-two cents; the balance due under the original contract, eight thousand five hundred and twenty-one dollars and five cents; and the amount of one thousand seven hundred dollars spoken of above; making a total of seventeen thousand four hundred and seventy-five dollars and eighty-seven cents. This wé believe to be a correct summary of the items as disclosed in the record. But it is said that Wakefield made other claims against the Terminal Company, the details of which are not given, and that these were taken into consideration by Garret-son when he settled and stated the former’s account. Garretson’s testimony in relation to this so-called settlement is as follows: “After the troubles came on, in justice to local creditors of Wakefield, whose claims were just, I made a settlement with Wakefield. I don’t understand that it in any way affects these first mortgage bondholders. It was a question of policy as to the best thing to do-, as the second mortgage bondholders, represented by the Credits people,, were going to ask favors, — bridge tax and so on. * * We didn’t go- into the matter of how much was actually due-him on the contract. The object and purpose of this settlement was to protect these lienholders as against the second mortgage, believing that it would ultimately come out of the second mortgage bondholders, who would be interested in the construction of the bridge and other things here, and could well afford to have this straightened to- secure the support of all the people in that matter.” It will be seen that this witness testifies in effect that, without regard to the amount actually due Wakefield, he allowed his claim in a sum sufficient to- pay all the subcontractors who were home creditors, expecting in the end to extort reimbursement from the second mortgagees. This alleged settlement is questioned by the Trust Company. Wakefield, in his petition, alleges that there is now due him, “by agreement and final settlement, an unpaid balance of $51,010.84.” This is met by a general denial on the part of the Trust Company. The point is now made by counsel for Wakefield that under these pleadings the Trust Company cannot attack the settlement; that the ground of complaint is fraud, and this must be averred in order to be proved. Under this general denial, we are clear the way is open to show want of authority in Garretson to bind the Terminal Company. Gilbert v. Baxter, 71 Iowa, 327. We may concede Garret-son’s authority, as its president and general manager, to bind the Terminal Company by an agreement of settlement, when entered into in good faith. But this transaction was something more than a settlement, and it can hardly be said to have been made in good faith by him. It was a deliberate attempt to make a gift to home creditors, not of the Terminal Company’s money (that would have been questionable enough), but of the money of the second mortgagees. If the Terminal Company had attempted to give Garretson express authority to carry out such a scheme, it could not legally have done so. Certainly, we shall not find, as we are asked to do> that his authority to so act is implied from his office and the nature of his employment. But, if we adopt the theory that the alleged settlement is attacked on the ground of fraud, we do' not see that the position assumed by Wakefield on this issue of the case can be sustained. Garretson’s testimony, upon which alone the Trust Company relies to defeat this settlement, was received without objection. The answer of the Trust Company contained only a general denial, and, conceding that upon objection this evidence could have been excluded on the ground that fraud was not pleaded, yet we think that a failure to SO' object waives all right to now claim that the court should not consider the issue. Logically, under a general denial of a settlement any evidence should be receivable'which tends to- show that no valid settlement was made. This testimony was certainly in point. If not admissible, it was only because of the formal rules of pleading. These may be waived. Under our practice, by failing to object in a timely and proper manner one may lose his right to insist that a pleading does not state a cause of action. Code 1873, section 2650; Linden v. Green, 81 Iowa, 365. In Mitchell v. Joyce, 76 Iowa, 449, defendant pleaded in a counterclaim matter which could not be properly set up in that manner. Evidence to sustain it was received without objection. Held, that such issue was rightfully in the case. Under the general issue a defendant introduced, without objection, evidence of a defense that could be properly offered only under a special notice attached to the plea. It was held that objection, not having been made in the court below, was to be dfeemed waived. Frankel v. Coots, 41 Mich. 75 (1 N. W. Rep. 940). The court in this case says: “One objection taken in this court for the first time would clearly have been good, if presented in the court below. The defendant seized and justified taking the property upon process against the assignor in favor of his creditors. The plea was that of a general issue only. There should have been a notice attached to the plea. Had this objection been taken in the court below, an amendment would undoubtedly have been permitted upon terms. When the parties do not think proper to raise such an objection, but proceed to and do try the case upon its merits, as though such notice had been given, we think they cannot raise the question in this court. It may fairly be said that they have-waived it.” See, also, Bank v. Boesch, 90 Iowa, 47; Isaacson v. Railway Co. 27 Minn. 463 (8 N. W. Rep. 600); Marshuetz v. Wright, 30 Wis. 175 (6 N. W. Rep. 511); Bowers v. Thomas 62 Wis. 480 (22 N. W. Rep. 710); Erickson Fisher, 51 Minn. 300 (53 N. W. Rep. 638). As is held in-this last case, where no objection is made to- the introduction of evidence relating to an issue not presented by the pleadings, it amounts to a consent to try such issue. It is true, Wakefield claims that prior to this settlement he had made various demands for large amounts against the Terminal Company, and that these claims had been previously canvassed and considered, and that they formed the basis of the agreement with Garretson. But, after careful consideration of all the testimony, we are led to believe that the agreement was brought about by the inducements mentioned by Garret-son, and by these alone. The right of the Trust Company to attack this settlement is questioned on another ground. It is said that, so long as the settlement is not objected to by the Terminal Company, its creditors cannot be heard to complain. It is doubtless true that general creditors of the Terminal Company could not complain of the amount of the liability which it chose to confess ; But the mortgagee stands in a different position. lie certainly has a right to question any action of the mortgagor which tends to illegally impair his security. Here was a deliberate attempt on the part of the mortgagor and a lienholder who» claims superior rights in the mortgaged property, to unwarrantably and unlawfully increase the latter;s claim to the-prejudice of the Trust Company. Any person who ha® acquired from another an estate has a right to protect it against burdens that are sought to be unlawfully imposed; upon it by the grantor. Des Moines Mfg. & Supply Co. v. Tilford Milling Co. 9 S. D. 542 (70 N. W. Rep. 839).

III. Next, as to the question of priority. We cannot follow counsel -in their discussion of this branch of the case without unwarrantably lengthening this opinion. We think the Terminal Company was a railroad corporation, within the meaning of the statute, and that the building of the union depot was the central thought and purpose of its organization. It was an essential part of the improvement, contemplated from the beginning. This being true, work done upon the building was work done upon the railroad; and the right to a mechanic’s lien for such work dates from the beginning of the improvement, and is against the whole road. Neilson v. Railway Co. 44 Iowa, 71; Brooks v. Railway Co. 101 U. S. 443; Meyer v. Hornby, 101 U. S. 728. The articles of incorporation of the Terminal Company provide that it may also construct warehouses, etc.; and it is argued here by counsel for the Trust Company that, if the depot is to be considered a part of the railway, so may any warehouse that may be constructed in the future. It is said that it would be manifestly unjust to give a lien superior to the mortgage to á laborer or material man who might do work or furnish material for a shed or warehouse that is hereafter erected. The distinction is this: No particular shed or warehouse was in contemplation at the time of the incorporation of the company. Any such building that might be erected would only be an incident of the work. But the depot was, according to all the evidence, an integral part of the undertaking, and the purpose to construct it was in mind from the beginning, and known to all parties. The mortgage in question bears date January 1, 1890. We find as a matter of fact that the work was begun on the Terminal Company’s property for the carrying out of its plan of improvements prior to that date. Wakefield’s lien for the amount we have stated is prior and superior to the lien of the Trust Company.

IV. The Credits Commutation'Company and E. IT. Hubbard, as a grantee in trust of the Terminal Company, and as assignee of the-ITnion Loan & Trust Company, file a cross petition in which they attack the validity of the mortgage made to> the Trust Company of North America, on various, grounds, which will be mentioned hereafter. The Union Loan & Trust Company was a second mortgagee of the Terminal property; holding, by express stipulation, subject to the mortgage of the Trust Company of North America. The Credits Commutation Company was the holder of a considerable floating indebtedness of the Terminal Company. No foreclosure of either of the mortgages is sought in this, action. As a matter of fact, foreclosure proceedings under the mortgage of the Trust Company of North America are pending in the federal court, and the Credits Commutation Company, the Terminal Company, and the Union Loan & Trust Company are parties thei’eto-, and have set up there the same matters they are now urging here. That case has been tried in the federal circuit court and in the circuit court of appeals, and in both instances the holding was in favor of the validity and priority of the mortgage of the Trust Company of North America. (69 Fed. Rep. 441; 27 C. C. A. 73, 82 Fed. Rep. 124). All that is asked in this case by thei’ cross petitioners who complain is that their claims be declared valid, and that the first mortgage be held invalid. We might with propriety leave these matters for settlement by the tribunal that has jurisdiction of the foreclosure, were it not for the fact that Wakefield urges the same claim in his behalf. As we permit the Trust Company bo question Wake-field’s settlement with Garretson only on the ground of its interest in the Terminal property, it becomes necessary, when that interest is denied, to determine whether the Trust Company has a mortgage.

Y. It is contended that the mortgage is void, first, because the Terminal Company had no legal right or power to make a mortgage; and in this connection we may also consider the claims made, that it had not the power to-mortgage its franchise, or to. give a lien on after-acquired property. The Terminal Company was, as already said, a’railroad company. That it was something more, we readily concede, but it was nothing less. Being such, it had the power, expressly given in section 1965, McClain’s Code, to mortgage its property, including its franchise. Section 1966 of said Code gives express authority to mortgage after-acquired property, and we may add that, when the power to mortgage exists, the right to- incumber after-acquired property is necessarily included. Such a mortgage is valid in equity by way of estoppel on the mortgagor and all persons claiming under him, whether voluntarily or otherwise. Mitchell v. Winslow, 2 Story, 630, Fed. Cas. No. 9,673; Christy v. Dana, 34 Cal. 548; Pennock v. Coe, 23 How. 117; 1 Jones, Mortgages 152, and cases cited.

VI. It is next urged that the mortgage in question is invalid because the debt it secures is in excess of the amount of indebtedness which the Terminal Company was legally empowered to incur. The capital stock of the company was one million dollars. We take it that "it is only the excess over two-thirds of this sum that can be questioned. Section 1061, Code 1873, limits the amount of indebtedness of corporations formed for pecuniary profit to two-thirds of the capital stock. By Twentieth General Assembly, chapter 22, this section was amended by adding the following proviso-: "Provided, that the provisions of this section shall not apply to- the bonds or other railway securities to be hereafter issued or guaranteed by railway companies of'this state, in aid of the location, construction and equipment of railways, to- the amount of not exceeding sixteen thousand dollars per mile of single track, narrow gauge, lines of road for each mile of railway actually constructed and equipped.” Twenty-first General Assembly, chapter 57, added another proviso, in these words: "Provided, further, that the provisions of this section shall not apply to- the debentures or bonds o-f any company, duly incorporated under the provisions of this chapter, the payment of which debentures or bonds shall be secured by an actual transfer of real estate securities for the benefit and protection of purchasers of said debentures or bonds, such securities to be at least equal in amount to the par value of such bonds or debentures, and to be first liens upon unencumbered real estate worth at least twice the amount loaned thereon.” The amount of indebtedness here is largely in excess of twoThirds of the amount of the capital stock, but it is thought by counsel for the Trust Company that the transaction falls within the terms of the last proviso quoted, and that the indebtedness is therefore sanctioned by law. This was the holding of the federal circuit court on the first trial of the foreclosure proceeding. First Nat. Bank of Montpelier v. Sioux City Terminal R. & W. Co. 69 Fed. Rep. 441. We are inclined to think the property mortgaged was at the time the indebtedness was incurred and the mortgage executed, worth double the amount of the debt, but we cannot agree that a mortgage given by a debtor corporation on its own property was intended to be covered by this proviso. It is a matter of public knowledge that within a comparatively late period many companies engaged in the business of making loans on real-estate security have adopted a method of procuring funds to invest, by which they issue their own bonds or debentures, which are placed in the hands of a trustee for sale, and which are secured by real-estate mortgages taken by such companies for other loans which they have made. For something on this subject, see 2 Cook Stock, Stockh. & Corporation Law, section 777. At about the time of the enactment of this amendment, companies were operating extensively in Iowa on this system. The amount of indebtedness, where this manner of business was carefully and honestly done, could not, under ordinary circumstances, prejudice any person interested in the corporation; and we can see good reason for taking such companies out from under the restriction of the original section. We think this proviso applies to a class, and not to a condition; that it singles out this particular kind of corporation, and is not meant to point’out a state of affairs which it was thought might exist with any corporation.

A^II. Tbe indebtedness for wbicb this mortgage was given being in excess of the amount fixed by law, it remains to be seen whether complainants have any standing to attack the validity of the transaction. The rights of all these cross petitioners accrued subsequent to the making and recording of this mortgage. AVhileAVakefield’s lien, in part, is given priority over the mortgage, his contract was made and his work was done after the mortgage was made and with full notice of it. The other complainants are the holders of an indebtedness that was incurred also in violation of the statute. The Terminal Company, which joins in the attack, has received,, and still retains, the benefit of the funds obtained on this’mortgage. The circuit court of appeals, on appeal from the federal circuit court of the case between these parties, and which may be found in 82 Fed. Rep. 124, affirmed the lower co-urt, but rested its holding upon the ground that complainants could not be heard to assert the invalidity of the Trust Company’s mortgage. The general rule, as stated in Twiss v. Association, 87 Iowa, 733, 737, is that “where an ultra vires contract is made, and performed on one side, the other party cannot be permitted to enjoy the benefits received, but will be required in a proper action to account; in other words, the doctrine of a want of power to contract cannot be invoked to ajd a party to perpetrate a wrong and injustice.” To like effect are the cases of Garrett v. Plow Co. 70 Iowa, 697; Warfield v. Canning Co. 72, Iowa, 666; Humphrey v. Association, 50 Iowa, 607. In Sedgwick on Statutory Construction, 73, it is said: “AYhen it is a simple question of authority to contract, arising either on a question of irregularity. of organization, or of power conferred by its charter, a party who has' had the benefit of the agreement cannot be permitted, in an action founded upon it, to question its validity. It would be in the highest degree inequitable and unjust to permit a defendant to repudiate a contract, the benefit of which he retains.” This language is quoted with approval in Pine Grove Tp. v. Talcott, 19 Wall. 666, and also in Bank v. Matthews, 98 U. S. 621. In Poole v. Association, 30 Fed. Rep. 513, the same doctrine was applied to a case where the contract made was in excess of an express statutory grant of power. So, too, in Fritts v. Palmer, 132 U. S. 282 (10 Sup. Ct. Rep. 93); Bank v. Matthews, supra; and Manchester & L. R. Co. v. Concord R. Co. 66 N. H. 100 (20 Atl. Rep. 383). In this last case the following statement of the laAV by a learned text writer is approved: “If an agreement is legally void and. unenforceable by reason of some statutory or common-law prohibition, either party to the agreement, who has received anything from the other party, and has failed to perform the agreement on his part, must account to the latter for what he has received. Under these circumstances the courts will grant relief irrespective of the invalid agreement-, unless it involves some positive immorality, or there are other reasons of public policy why the courts should refuse to grant relief in the case.” See, also, on this subject, Wood v. Waterworks Co. 44 Fed. Rep. 146; Central Trust Co. v. Ohio Central Ry. Co. 23 Fed. Rep. 306; Planters' Bank v. Union Bank, 16 Wall. 483; Gold-Mining Co. v. National Bank, 96 U. S. 640; White v. Bank, 22 Pick. 181; Whitney v. Peay, 24 Ark. 22; Whitney-Arms Co. v. Barlow, 63 N. Y. 62; McCarthy v. Lavasche, 89 Ill. 270; Prairie Lodge v. Smith, 58 Miss. 301; Oil Creek & A. R. R. Co. v. Pennsylvania Transp. Co. 83 Pa. St. 160; Madison Avenue Baptist Church v. Baptist Church in Oliver Street, 73 N. Y. 82; Central Trust Co. v. Ohio Central Ry. Co. 23 Fed. Rep. 306; Campbell v. Aryenta Co. 51 Fed. Rep. 1. A distinction is to be taken between contracts like this and those which, independent of statute*, are in violation of public policy. The creation of this indebtedness involved no moral turpitude. The making of the mortgage did not disable the corporation from performing its duties to the public. The Terminal Company had a right to incur a debt, and to execute a mortgage to secure it. The only ground of complaint is that it went further than the Irav permitted. Of this the state may complain, but the Terminal Company cannot; nor can any person whose rights are derived through the Terminal Company, and who acquired such rights with knowledge of the mortgage lien. Oil Creek Co. v. Transportation Co., supra; Union Water Co. v. Murphy's Flat Fluming Co. 22 Cal. 620. It will not do to say that the lien should be held invalid, but that the Trust Company may have an action for its debt, as for money had and received. Such a right is of no value now. The Terminal Company should make restitution before it has standing to complain. It is not enough for it to- say that it is insolvent, and cannot repay what it has received, but that it will submit to an action on the part of the Trust Company. We are aware that the security has been held invalid, and a right of recovery thereon denied, in many cases where an action has been permitted upon the common counts. But we think these cases will be found to involve contracts which were absolutely void, and not, as in the case at bar, voidable only. This distinction is clearly preserved in the cases. In Garret v. Plow Co., supra, the indebtedness exceeded the charter limit of the corporation, and the creditors had notice thereof when the transaction took place; and yet a right of recovery was allowed, and the lien of a mortgage upheld. See, also, Warfield v. Canning Co., supra; Jones Mortgages, section 127; Morawetz Private Corporation, 714, 716; Allis v. Jones, 45 Fed. Rep. 148, and cases therein cited. A sound basis appears to exist for this holding. It is the debt which is prohibited, and not the mortgage. So long as the debt in any form can be enforced, the mortgage should stand.

VIII. It is said that the Terminal Company, being a railroad corporation, was quasi public in character, and that the rule stated, which applies to1 private corporations, should not obtain as against it. It is true that a railroad eorporation has a dual character, that in many respects it is of a public nature, and that the courts will not enforce against such a corporation a-contract which will disable it from performing its duties to the government or the people. Central Transp. Co. v. Pullman's Palace Car Co. 139 U. S. 24 (11 Sup. Ct. Rep. 478). But we repeat that this mortgage bas no such effect. On the other hand, a railroad company is in many respects a purely private corporation. It is organized in this state under the same section of the Oode which provides for the incorporation of all other companies for pecuniary profit. The restriction as to indebtedness applies to all corporations organized under this section. Under ordinary circumstances, we see no reason for distinguishing between them. It is said further that the plea of estoppel can be urged only in favor of the innocent, and that the bondholders here are not of that class, for they are held to notice of the corporate power of the Terminal Company. This rule has been applied in cases where the act done was wholly void because of an absolute want of power to sustain it, and in cases where considerations of public policy intervened. Here, as repeatedly said, the act is voidable only. The statute does not even impose a penalty therefor. The purpose of the law is to protect stockholders against the acts of reckless or dishonest officials of the corporation. In the present instance the stockholders of the Terminal Company are in nowise injured, for, so far as the record discloses, they had the benefit of all the money raised on this mortgage. There is no demand of public policy that this transaction be held invalid. Many of the cases cited above, in which it is held that the plea of estoppel will lie, are similar to the case at bar in this: that upon its face the act done was in excess of the charter power. See, also, on this point, Matt v. Society, 70 Iowa, 455; Wright v. Pipe-Line Co. 101 Pa. St. 204; Witter v. Mill Co. 78 Wis. 543 (47 N. W. Rep. 729); Carson City Savings Bank v. Carson City Elevator Co., 90 Mich. 350 (51 N. W. Rep. 641); Dewey v. Railway Co. 91 Mich. 351 (51 N. W. Rep. 1063), and cases cited. In this last case the rule as laid down by Morawetz in his work on Corporations (section 684) is stated and adopted. That rule is as follows: “It does not follow, because the exercise of certain corporate powers is prohibited by the common law, any corporate act performed in violation of this prohibition will not be recognized by the law as a corporate act. * * * The prohibition of the common law against the unauthorized exercise of corporate power is based upon the ground of public policy alone, and the effect of this pro*hibition should be determined by the requirements of public policy; and, after a contract made by a corporation in excess of its powers is wholly performed by either party, * * * it cannot be said to be in the interest of public policy to deny the innocent party relief. * * * General statutory prohibitions against any corporate act not included in the powers conferred by the charter do nothing more than declare the common law of prohibition against any exercise of corporate powers which has not been authorized by the legislature, and the common-law rule would prevail.” It will be observed that in this case the doctrine stated is applied against a railway company, and in favor of a creditor, who, as cross petitioners say, was charged with notice of its charter power. We might cite many other cases of like character, but it seems needless. The conclusion we have reached on this point, after an examination of numerous authorities, is that the creditor is to be deemed “innocent” whenever the transaction involves no moral wrong on his part, and can be carried out without contravening any requirement of public policy. The circuit court of appeals, passing upon this issue in the action between these parties, said: “Nor is the innocence or ignorance of the creditor essential to the maintenance of his suit to enforce such* a contract. * * .* These decisions do not rest upon the principle of 'estoppel, nor depend upon the creditor’s ignorance of the excessive indebtedness. They stand upon the rule that he who seeks equity must do equity; and upon the principle that he may not at the same time accept the benefits and repudiate the burdens of his contract.” We take this rule to be correct, but we conceive it to be only an indirect assertion of the doctrine of estoppel. All parties wlm join here in the attack on this mortgage have been benefited by the transaction for, as we have said, the funds secured thereby were used to improve the property upon which they have their liens, or against which they make their claims. We think the plea of estoppel is good against the Terminal Company and those claiming under it; but whether we rest the holding in terms upon this ground or upon the general equitable principle stated by the federal court, the result is the same: The cross petitioners have no standing to object to the bonds or mortgage of the. Trust. Company.

IX. Another point urged against the mortgage is that the instrument as executed was materially different from the form approved by the board of directors of the Terminal Company. As we have seen, the Terminal Company negotiated the bonds secured by this mortgage, and received and appropriated the funds derived from their sale. Under these circumstances, it is in no situation now to complain of the terms and conditions of the mortgage. That instrument, if not originally authorized, has been ratified. Jones Mortgages, section 127; Hotel Co. v. Wade, 97 U. S. 13; McCurdy’s Appeal, 65 Pa. St. 290; Aurora Agricultural Society v. Horticultural Society, 80 Ill. 263.

X. These are the controlling points in the case: Some other questions are discussed by counsel, but we do not deem it necessary that they be specially noticed.

XI. Our conclusion upon the whole case is that the Gillette-Herzog Company should have a lien as allowed by the trial court, but that it should rank eleventh in order of priority as the claims are numbered in the decree, and it should have no personal judgment against Wakefield; that Wakefield is entitled to a judgment and lien, as against the Terminal Company, for the sum awarded by the district court, but that only the amount of seventeen thousand four hundred and seventy-five dollars and eighty-seven cents, with proportionate interest, should-be established as superior to the mortgage of the Trust Company of North America. With these modifications, the decree of the district court is AEEIRMED.

On Rehearing Tuesday, February 7, 1899. — Modified.

Waterman, J.

A vigorous assault was made upon the foregoing opinion, in an application for a rehearing, by most of the numerous parties interested. While we do not think it necessary to reopen the case, we have concluded to make certain modifications in the holdings first announced. In the original opinion, the Gillette-TIerzog Company was advanced from the thirteenth to the eleventh place in the list of mechanic’s lien claimants as fixed by the district court. We conclude, upon consideration, that the change was not warranted. The lien is, therefore, reinstated in the place from which we attempted to take it.

II. Next, as to the amount due Wakefield, which was .allowed precedence over the mortgage of the Trust Company of North America. This we fixed at seventeen thousand four hundred and seventy-five dollars and eighty-seven cents. In the reply of the trust company named there is an admission of nineteen thousand and six dollars and fifty-one cents as due Wakefield under his contract and for extras. It is 'claimed by the trust company that this amount was inadvertently stated, through an error in writing the figures. We may say further, as to this matter, that this admission, though mentioned in the statement of the case by the opposing parties, was not insisted upon in argument. Wakefield, and those claiming under him, relied wholly, in their discussion of the case, upon the settlement with Garretson,. and insisted upon their right to the amount therein allowed. But, notwithstanding these facts, we think they are entitled to the benefit of the admission. This amount, added to the one thousand seven hundred dollar item spoken of in the former opinion, would make the sum of twenty thousand seven hundred and six dollars and fifty-one cents due Wakefield from the terminal company, which should have priority over the mortgage of the Trust Company of North America.

III. These are the corrections which we think proper to make. There is, however, another matter of which it is well to speak, now that we have the case again under consideration. Under Wakefield’s contract the terminal company was obliged to" reserve fifteen per cent, of the amount due him until the completion of his contract, and it is strenuously claimed that this sum — about fifteen thousand eight hundred and seventy-five dollars and fifty-eight cents — should be added to the amount we have found to be due him. In making this claim on behalf of the mechanic’s lien claimants, another clause of the contract is wholly overlooked. That instrument provided that if Wake-field failed to complete the work, the terminal company might do so and deduct the cost thereof from the amount due him. This contingency occurred. Wakefield failed in his contract. The terminal company assumed the work and completed the building at a cost in excess of the fifteen per cent, reserve. It had a legal right to draw upon the reserve for this purpose, and, having exhausted it, can m> more be compelled to account for it to Wakefield’s creditors than to Wakefield if he were seeking a recovery on the contract. The terminal company acted strictly according to its contract, and this it had a right to do'. Epeneter v. Montgomery Co. 98 Iowa, 159, and cases cited.

Some other matters were pressed by counsel on the application for rehearing, but, as they were urged then for the first time, not having been noticed on the original submission, we can give them no consideration. With the modifications stated, the original opinion will stand.  