*351On Rehearing.
(Submitted May 31, 1921. Decided June 20, 1921.)
MR. JUSTICE REYNOLDSdelivered the opinion of the court.
Since this case was tried upon an agreed statement of
[6] facts, defendant contends that under the rule applicable to such cases it was the duty of the trial court to apply the law to the facts and render judgment in accordance with the merits of the case as disclosed by the agreed statement of facts, and on the hearing in this court judgment should likewise be entered, or directions given for its entry, and that we should not send the case back to the trial court for a new trial. We are satisfied that this contention is sustained by the great weight of authority and that our duty in this case is to direct entry of such judgment as may be justified by the facts. (City of Jeffersonville v. John Shallcross Co., 35 Ind. 19; Gillett v. Detroit Board of Trade, 46 Mich. 309, 9 N. W. 428; Brown v. Rogers, 61 Ind. 449; Milk Co. v. Eagle Mfg. Co., 47 App. D. C. 191; Benavides v. Benavides (Tex. Civ. App.), 218 S. W. 566; Hurey v. Leavitt, 93 N. J. L. 299, 107 Atl. 457; Hills v. Hopp, 287 Ill. 375, 122 N. E. 510; McGonigle v. Gordon, 11 Kan. 167; Green v. Prince (Tex. Civ. App.), 201 S. W. 200; Big Horn Lumber Co. v. Davis, 14 Wyo. 455, 7 Ann. Cas. 940, 84 Pac. 900, 85 Pac. 1048; Irvine v. Angus, 93 Fed. 629, 35 C. C. A. 501; Roberts v. Corbin, 28 Iowa, 355; Allen v. St. Louis National Bank, 120 U. S. 20, 30 L. Ed. 573, 7 Sup. Ct. Rep. 460; Churchill v. Buck, 102 Fed. 38, 42 C. C. A. 148; Hatfield v. Cabell County Court, 75 W. Va. 595, 84 S. E. 335; 3 Cyc. 451, notes 5 and 6.)
[7] On rehearing it is the prerogative of this court to review the entire case and correct any error that may be apparent, even though such action may not be favorable to *352the movant. Respondent contends that it was an error on the part of this court in holding in its original opinion that there was a fatal variance between the pleadings and the proof. This contention is based upon the proposition that, in a case in which an agreed statement of facts is made and such agreed statement of facts purports to contain all of the evidence, the pleadings become immaterial, except in so far as admissions therein contained are concerned. We deem this contention of merit; for, after the parties to an action have agreed upon all the facts involved in the case, the plaintiff or defendant, as the case may be, is entitled to such judgment as the agreed statement of facts may disclose. (West Roxbury v. Minot, 114 Mass. 546; State Bank v. Norduff, 2 Kan. App. 55, 43 Pac. 312; Willard v. Wood, 135 U. S. 309, 34 L. Ed. 210, 10 Sup. Ct. Rep. 831; Saltonstall v. Russell, 152 U. S. 628, 38 L. Ed. 576, 14 Sup. Ct. Rep. 733; Esty v. Currier, 98 Mass. 500; Scudder v. Worster, 11 Cush. (Mass.) 573.) A few excerpts from the cited cases will clearly disclose the attitude of the various courts upon this proposition:
“Upon an agreed statement of facts, the only question open is whether the plaintiffs can recover upon any form of declaration or in any form of action.” (West Roxbury v. Minot, 114 Mass. 546.)
“The first specification of error is that the petition does not state facts sufficient to constitute a cause of action against plaintiffs in error, and this question is raised in this court for the first time. No objection, either by demurrer or otherwise, was taken in the court below. We do not consider that, under the pleadings in this case, and the fact that the case was tried to the court upon an agreed statement of facts, plaintiffs in error are now in a position to raise this question. The objection now raised is to the form of the petition alone, and all the subsequent pleadings, and the action of the parties in the trial of the cause, were upon the theory that the petition was sufficient. Undoubtedly, after the submission of the case to the court upon the agreed statement • of facts, *353an amendment would have been permitted if the attention of the trial court had been directed to the alleged defect, and it cannot be claimed that the defendants would have been in any manner prejudiced by such amendment. Such being the case, we feel that this court should treat the record as if such amendment was in fact made, and that the judgment ought not to be disturbed for this alleged error. Railroad Co. v. Caldwell, 8 Kan. 244; Pape v. Bank, 20 Kan. 440.” (State Bank v. Norduff, 2 Kan. App. 55, 43 Pac. 312.)
“A statement of facts agreed by the parties, or, technically speaking, a case stated, in an action at law, doubtless waives all questions of pleading, or of form of action, which might have been cured by amendment.” (Willard v. Wood, 135 U. S. 309, 34 L. Ed. 210, 10 Sup. Ct. Rep. 831.)
“A case having been submitted to the circuit court upon a statement of facts agreed by the parties, or case stated, upon which the court was to render such judgment as the law required, all questions of the sufficiency of the pleadings were waived, and the want of an answer was immaterial.” (Saltonstall v. Russell, 152 U. S. 628, 38 L. Ed. 576, 14 Sup. Ct. Rep. 733.)
“But an agreed statement of facts waives all defects in the pleadings, even if the pleadings are referred to as part of the statement, and authorizes such a judgment on the merits as if they were duly presented by proper pleadings.” (Esty v. Currier, 98 Mass. 500.)
“The first question presented, that of proper pleadings and specification of defense, would have been more properly raised had the case taken the ordinary course of a trial by jury. By making a statement of facts, and asking the judgment of this court thereon, the parties are understood to have waived all questions as to the formal pleadings, unless those questions are in direct terms reserved.” (Scudder v. Worster, 11 Cush. (Mass.) 573.)
The question, then, to be determined by this court is whether or not, upon the agreed statement of facts, plaintiff *354is entitled to recover, regardless of the pleadings. In the original opinion we held that plaintiff could not recover because it did not appear from the agreed statement of facts that the crop in question had been removed from Carbon county, and that therefore plaintiff was entitled as mortgagee to the possession thereof. The mortgage, which is made a part of the agreed statement of facts, discloses that there were other contingencies upon the happening of which plaintiff would become entitled to the immediate possession of the crop, among which are included such instances as the making of a claim on the crop by any other person or persons, any disposition of the crop, or the harvesting of the crop. The agreed statement of facts shows the existence of each of the three grounds of right to possession above mentioned, and therefore the agreed statement of facts does show upon its face that plaintiff was entitled to the possession of the crop. This supplies the defect in plaintiff’s ease due to variance between pleading and proof, as pointed out in the original opinion, and completes plaintiff’s right of action.
In the original opinion, in discussion of proposed amendment, we stated that the record itself excludes the idea that .the ease was submitted on the theory involved in such proposed amendment. In that expression we had reference to the theory of the case as disclosed by the pleadings. In looking at the matter upon the basis of the theory of the case as disclosed by the agreed statement of facts, our conclusion is necessarily different from what it would be in reaching a result based upon the theory involved in the pleadings. We are therefore of the opinion that, upon the agreed statement of facts, plaintiff is entitled to recover in this action.
The order heretofore entered in this ease is overruled, and it is ordered that the judgment be affirmed.
Affirmed.
Mr. Chief Justice Brantly and Associate Justices Cooper, Holloway and Galen concur.