Rio de Janeiro finally got a federal bailout, with nearly a month to go before the Olympic Games start here.
Brazil's federal government issued a 2.9 billion real ($900 million) loan to finance Olympic security in the state of Rio, after it declared a state of financial emergency earlier this month.
The cash will also be used to pay police officers, who haven't received overtime for over six months, and to put gas into the tanks of their patrol cars. The state governor told O Globo newspaper that those cars would run out of gas by the weekend without the loan.
Rio is struggling to show the world it's ready to host the Olympics in five weeks.
The latest challenge came Wednesday, when a beachgoer discovered human body parts that washed up on the shore, right in front of the Olympic Beach Volleyball Arena on Rio's famed Copacabana beach.
Related: Rio's horror week: body parts wash up onshore
It's the latest in a string of bad news for Rio.
A few Olympic athletes have been robbed in Rio, some in broad daylight, as they prep for the Games. A drug-related shootout recently occurred at one of the hospitals in Rio designated to treat tourists visiting for the games. And a metro line connecting the Olympic facilities to downtown Rio is still unfinished.
Concerns about the Zika virus remain high. Some athletes are skipping Rio for fear of contracting the disease, even though the games will be played in Brazil's winter when mosquitoes are much less prevalent.
Rio officials stress the city will be prepared. The president of Brazil's federal tourism agency, EMBRATUR, told CNN Thursday the city will have 85,000 police and military officers guarding the city for the games. Other officials say the metro line will be finished a few days before the Olympics begin.
Related: Brazil dives deeper into recession
The state of Rio has fallen on hard economic times like the rest of Brazil, which is in its longest recession since the 1930s. Rio's economy depends on oil, and as oil prices have fallen for two years, so have Rio's revenues.
Brazil is also in the midst of a political crisis. Interim President Michel Temer took over for President Dilma Rousseff in May, after Congress voted to begin an impeachment trial against her and suspend her term in office for six months.
Now Temer has his own problems. Three of his ministers have resigned due to allegations that they're tied to the widespread corruption scandal at Brazil's state-run oil company, Petrobras.
The games in Rio are set to kick off on August 5.