This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

Airbnb said Tuesday that it earned $379 million in the second quarter on record bookings and rising rates, and the short-term rental giant announced a plan to spend up to $2 billion to buy its own stock.

The results showed a reversal from losses in the second quarter of both last year and 2019.

Airbnb indicated that its third-quarter revenue will be better than analysts currently forecast, although the gross value of bookings in the second quarter fell short of Wall Street expectations.

Airbnb has benefitted from the increase in travel and the exodus of workers from offices, which frees them to work from just about anywhere they can get internet access.

Bookings in the second quarter were about one-fourth higher than last year and 2019, but their gross value of $17.0 billion was slightly below analysts’ forecast of more than $17.1 billion, according to FactSet. Chief Financial Officer Dave Stephenson said the gross value of bookings is still rising sharply compared with 2019.

The San Francisco-based company said customers were making more international bookings. Listings away from major cities rose nearly 50% compared with the second quarter of 2019, and Airbnb said urban listings grew compared with the previous three months.

Stephenson said Airbnb saw higher numbers of cancellations late in the quarter, which he blamed on airlines canceling flights. Most of the cancellations were in North America, Stephenson said. He did not give figures.

Airbnb said the daily rate paid by renters averaged $164, up 1% from a year ago and 40% from the same period in 2019. The shift in bookings — from cities to less populated areas such as beach and mountain destinations, and toward renting an entire house — has helped drive prices higher. Stephenson said, however, that now it’s mostly just price appreciation, which “has been stickier than what we anticipated maybe six months ago.”

Airbnb said it that excluding stock-based compensation and some other costs, it earned 56 cents per share.

Revenue rose 58% from a year earlier and 73% from the second quarter of 2019, to $2.10 billion. Analysts expected revenue of $2.11 billion, according to a FactSet survey.

Airbnb said third-quarter revenue would be between $2.78 billion and $2.88 billion on “slightly higher” average rental prices. Analysts expect $2.77 billion.

Airbnb’s stock fell more than 8% in about two hours of extended trading.