Imagine you’ve gotten the keys to your new house and you’ve moved in. You’re on a homebuyer’s high — until you discover a leaking roof or a snake infestation. What do you do? Here are some ways to avoid a costly post-closing catastrophe.

Look at the listing language

Some properties are listed for sale “as is,” but you should clarify if that means the seller is absolutely unwilling to address major safety issues that might come up in an inspection that would make it difficult for them to sell the house to any buyer, says Liane Jameson, a Florida real estate broker. If a seller doesn’t want to fork out any money for repairs, be prepared to move on, she says.

Know your lender’s requirements

Many mortgage lenders require that certain safety issues, such as high radon levels, a decayed roof or dangerous structural defects, be addressed before they’ll give you a loan.

Check out the property and seller online

If you find a house that’s been renovated recently, check your county’s online records to see if the proper building permits were pulled, says Kris Paolini, a real estate agent in Maryland. You want to make sure that major renovations are up to code.

Get a home inspection

When you buy a house, even new construction, always hire your own inspector to do a thorough home inspection, which typically costs between $300 and $500, Paolini says. While an inspector might not catch everything, particularly if a seller is hiding something intentionally, you shouldn’t skip this step, because problems that pop up later could cost you big bucks.

Review the seller’s disclosures

Generally sellers are supposed to reveal any “latent defects” — problems that a standard inspection can’t reasonably be expected to reveal, says real estate attorney Robert Moses. Home buyers should always ask for repair or renovation documentation. Also, be wary of sellers who disclaim knowledge of the home’s condition; that’s a red flag, Moses says.