
626 P.2d 1259 (1981)
Margarette M. AYE, Clara E. Gregory et al., Plaintiffs and Appellants,
v.
Adolph Fix and Robert Fix, Defendants and Respondents.
No. 80-125.
Supreme Court of Montana.
Submitted on Briefs November 19, 1980.
Decided April 20, 1981.
*1260 Robert L. Stephens, Jr., Kinnard & Woodward, Billings, for plaintiffs and appellants.
Gene Huntley, Baker, R.W. Heineman, Wibaux, for defendants and respondents.
SHEA, Justice.
Plaintiffs Ralph and Frances Bruski appeal the judgment of the Carter County District Court awarding them only $3,013.21 for the defendants' occupation of certain state-leased land during the years 1971, 1977 and 1978, in derogation of the Bruskis' right to possession.
The dispute between the parties centers on the right to occupy and farm a section of state-leased land known informally as the "school section" or the "school lands", State Lease No. 49401. The parties have been embroiled in litigation over the property at both the trial and the appellate levels for nearly a decade. The case has become confusing and complex. For that reason, we will review the factual background and procedural history of the case before setting out the issues presented for review.
The Ayes, are now and always have been the official lessees of the school section from the state. The Fixes and the Bruskis both claim to have had the right to occupy and farm the land in 1971 under separate, but conflicting transfers from the Ayes  the Fixes as sublessees and the Bruskis as assignees of the Ayes' lease with the state.
In December 1963, Willis Aye (Aye) orally agreed to assign the state lease of the school lands to Adolph Fix (Fix) in order to induce Fix to buy some other farmland from him known as the "Perso" place. Fix paid the purchase price that had been agreed upon and received a deed for the Perso place, but no assignment of the state lease. Shortly thereafter, on January 3, 1964, John Aye (the brother of Willis) leased 5,000 acres of land to Fix. The lease *1261 agreement expressly granted to Fix a sublease to the school lands for the entire unexpired term of the Aye lease with the state. Fix objected to this sublease language because he understood that he was supposed to be the assignee of the state lands rather than a sublessee. Aye explained to Fix that he would get the state lease at the end of the term. Fix accepted these oral assurances as a sufficient assignment of the lease.
The Ayes' lease of the school lands from the state  and, therefore, the Fixes' right to possession under their sublease from the Ayes  was set to expire on February 28, 1972. But before this expiration date, on February 12, 1971, the Ayes' attorney sent written notice of cancellation of the sublease agreement to Fix. At about the same time, the Ayes entered into a contract for deed which assigned the state lease to the Bruskis. The Ayes renewed their lease of the school lands when it expired by exercising their statutory right to meet the highest competitive bid for the land. Their right as state lessees of the land remained subject to the contract for deed with the Bruskis.
The Fixes refused to vacate the school lease land and litigation ensued. On July 13, 1972, the trial court ordered that the Fixes surrender possession of the state-leased lands to the Ayes in accordance with the 1972 renewal lease issued by the Department of State Lands and Investments. The Bruskis, under the assignment of the land from the Ayes, then occupied the school lands from July 13, 1972 until March 23, 1977. Following the bench trial on the merits, the trial court ruled that Fix was the "owner" of the state lease based on the oral agreement between Fix and John Aye that Fix would be assigned the state lease as part of the sale of the Perso place. After the trial court judgment in their favor, the Fixes reoccupied the premises on March 23, 1977, and remained in possession until August 25, 1978.
The Ayes and the Bruskis appealed the trial court judgment to this Court. We reversed. Invoking the statute of frauds and the parol evidence rule, we held that the trial court should not have admitted evidence on an oral agreement to assign the state-leased lands to the Fixes because the written agreements between the Ayes and the Fixes expressly referred only to a sublease and not to an assignment of the state lease. Because the Fixes had been in possession of the property for parts of the years 1977 and 1978 under the trial court judgment, we remanded for a determination of damages they owed to the Bruskis. Aye v. Fix (1978), 176 Mont. 474, 580 P.2d 97.
After our reversal, the Bruskis again reentered the property and are now in possession. At this point in the litigation, the Bruskis and the Fixes are the only real parties in interest. The Ayes claim no right to compensation for the Fixes' use of the land during any of the three years in dispute.
The Bruskis now appeal the amount of compensation awarded them by the trial court for the three years during which the Fixes were in possession of the land: 1971, 1977 and 1978.
They raise three issues. First, they assert that the trial court erred in finding that the Fixes did not owe them any rent for the use of land in 1971. Second, they assert error on the trial court's ruling that the Fixes could offset certain lease payments made directly to the state from the reasonable rental owing to the Bruskis. Third, they challenge the trial court's holding that the Fixes were the rightful recipients of certain federal farm benefits for the years they were in possession of the land. We affirm in part and vacate in part.
On remand, the trial court ruled that the Bruskis were entitled to no rental from the Fixes for the year 1971. In so ruling, the trial court relied on its original finding before the first appeal of this case that the Fixes were the "lawful owners" of the lease for the year 1971. This finding was based on the 1964 lease agreement where the *1262 Ayes expressly subleased the land to the Fixes for the full unexpired term of Ayes' lease of the land from the state.
Given the state of the record before us, we are unable to adequately review the trial court's determination that Fixes, and not Bruskis, were entitled to possession of the property in 1971. Neither the record before us nor the briefs of the parties indicate whether either the Fixes or the Bruskis ever recorded their respective conveyances from the Ayes. We do not know if the recording statutes (Title 70, Ch. 21) were complied with. Nor do we know whether Bruskis were aware of Fixes' occupation of the land at the time the Ayes assigned the state lease to the Bruskis in 1971. See, section 70-21-102, MCA. Therefore, we have no way of knowing whose interest has priority under the law. See, section 70-21-304, MCA. We, therefore, remand to the trial court to make that determination.
Furthermore, we disagree with the Bruskis' argument that former section 81-419, R.C.M. 1947, nullified the sublease that Fixes received from Aye in 1964. At the time the sublease to the Fixes was made, that section provided that a sublease of state land was illegal unless a copy of the sublease accompanied by a fee of $2.00 had been filed with the state land office and approved by the commissioner. Section 81-419 does not override the provisions of section 70-21-102, MCA, which provides that "[a]n unrecorded instrument is valid as between the parties and those who have notice thereof." The purpose of section 81-419, R.C.M. 1947, is to facilitate the management of state lands but it does not abrogate general principles of property law. The statute must be read in the context of the chapter in which it appears. By declaring a sublease that is not filed with the commissioner to be illegal, the statute allows the commissioner to look to the original state lessee as the party responsible for full compliance with the terms of the state lease.
The Bruskis also argue that because of our reversal of the trial court's judgment on the first appeal of this case, the trial judge could not rely on his original finding that the Fixes were rightfully in possession of the property under the 1964 sublease from the Ayes. But a reversal extends only to those issues which the appellate court decided in actuality or by necessary implication; it does not affect collateral matters not before the court. Phalen v. Rilley (1970), 156 Mont. 91, 475 P.2d 998, 999; Ryan v. Ald, Inc. (1967), 149 Mont. 367, 427 P.2d 53, 56.
On remand, the parties stipulated that the measure of damages owing to the Bruskis from the Fixes would be the reasonable rental value of the land for the years that the Fixes occupied the premises in derogation of the Bruskis' right to possession. On this issue, the Bruskis contend that the trial court erred in permitting the Fixes to offset from reasonable rental value the lease payments which the Fixes made directly to the State of Montana. We find no error. As a general rule, the party to whom property has been awarded under an erroneous judgment may, upon reversal, deduct expenses that he necessarily incurred in the protection of that property and the payment of taxes and liens. Restatement Restitution § 74, Comment (e) (1937). The rental which the Fixes paid to the state was an expense incurred to protect the property and was therefore properly deducted from the stipulated rental. We cannot agree with the Bruskis' attempts to label the lease payments to the state as a "cost of production" for which the Fixes as crop producers should be responsible. To require the Fixes to pay the Bruskis a reasonable rental and then to add to that sum the rent due the State of Montana is  as the trial court found  to require the Fixes to pay rent twice.
Finally, the Bruskis urge that the trial court should have awarded them and not the Fixes the benefits of the federal A.S.C.S. program for the years 1971, 1977, and *1263 1978. A.S.C.S. payments are made to producers who raise crops in accordance with certain federal guidelines. One-third of these payments went to the state as part of the rental due on the state lease. The remaining two-thirds has been withheld pending a final determination as to which of the parties is entitled to the A.S.C.S. payments. Neither party has had access to these funds during the pendency of the litigation.
The Bruskis argue that these payments represent an issue of the land to which they are properly entitled. Generally, a party who has been dispossessed of property by an erroneous judgment is entitled, upon reversal, not only to specific restitution of the property in question, but also to rents, issues or profits therefrom. 5B C.J.S. Appeal and Error § 1983 (1958); Mann v. Thompson (Fla.App. 1960), 118 So.2d 112, 114-15; see also, Waggoner v. Glacier Colony of Hutterites (1957), 131 Mont. 525, 312 P.2d 117. We agree that the trial court should have awarded the A.S.C.S. benefits to the Bruskis for the years 1977 and 1978. Had it not been for the trial court's erroneous judgment before the first appeal of this case, the Bruskis would have been in possession of the land, could have farmed it, and would have been entitled to the lessee's two-thirds share of the A.S.C.S. payments. Who is entitled to the A.S.C.S. benefits for 1971 depends, of course, on which of the two conveyances from the Ayes had priority in that year.
In occupying the land in 1977 and 1978 under the trial court judgment in their favor, the Fixes were not in the position of trespassers whose wrongs were to be corrected by an action at law. They were trustees, subject to make such restitution as a court of equity might determine, if the trial court judgment were overturned. They were charged with the knowledge that they entered onto the land by force of a judgment not yet final. A trial court's judgment depends for its validity on being sustained. When it is reversed or set aside, the party who has received the benefit of that judgment must make restitution to the other party. Nothing prevents a court, however, in exercise of its equitable powers to allow the party making restitution reasonable compensation for labor or improvements benefiting the land.
We affirm the trial court's judgment insofar as it permits the Fixes to deduct from the rental owed to the Bruskis the lease payments paid directly to the state. We vacate the trial court's judgment insofar as it awards the lessee's share of the A.S.C.S. payments to the Fixes for the years 1977 and 1978. We order those benefits to be paid to the Bruskis. We vacate the trial court's ruling that the Fixes were lawfully in possession of the land in 1971 and remand for the trial court to determine whether the Fixes' or the Bruskis' interest in the land had priority for that year. The trial court is directed to award the 1971 A.S.C.S. payments to the party having priority.
HASWELL, C.J., and HARRISON, SHEEHY and DALY, JJ., concur.
