It’s inevitable that sometime after you sign the paperwork and take possession of your new house, you’ll have to wake up in the middle of the night to deal with some kind of problem, like a toilet that won’t stop running or a leaky pipe. But now there’s no landlord to call, no emergency number for maintenance–it’s all up to you to fix things. So how do you do that?

Of course, every situation has its own challenges, but there are a few key things to do in the moment that can help you cope with the situation.

Know How to Shut Off the Water

Your home inspection should have given you all kinds of useful knowledge about your new house, including where to find the main water shutoff valve. Find it yourself and make sure it works and you, and everyone in your family, knows how to use it. Most situations will involve leaks or overflow, so the first order of business is to shut off the water. In the case of toilets, some models have water valves near their base that lets you turn off the water to the tank. You should check this as well, to see if it works. If it doesn’t, back to the main valve.

Fixing a Toilet

If the toilet’s overflowing or clogged, don’t try to flush it again. Turn off the water, either on the toilet valve or main water valve. Mop up the extra water as soon as you can. Try to keep it away from carpet and off plaster and wood if you can. Drywall in bathrooms is supposed to be water-resistant, so it’s less of a priority. Once the excess water is dealt with, then you need to start with a good plunger. Most clogs come from trying to flush things that don’t fit in the drains well, such as paper towels or cardboard. Make sure to make a good seal at the bottom of the toilet with the plunger and give it several good pushes to dislodge the blockage. If it works, you’ll know it right away. If not, you might need to get a professional.

Handling a Leak

This is all about the nature of the leak. If it’s just a faucet that won’t shut off properly, it’s usually best to just replace it. There are plenty of videos on the Internet about how to make this work. The employees at most home repair stores are also a good resource, and might be able to talk you through the steps when you’re buying the replacement. If the leak is because you inadvertently put a nail or screw into a pipe, shut off the water, leave the nail where it is to help plug the hole, and talk to a plumber.

Also, during home inspection, you should ask questions about pipes that are likely to freeze, or different materials of pipes that might not be joined up correctly. Know where the problems might happen to avoid them. Wrapping pipes with heat tape, keeping a slow drip going, and improving insulation are all ways to avoid frozen pipes.

Know Who to Call

Go through the list of plumbers working in your part of town, and check what their service hours are. Look at customer rating sites to see who actually responds to calls 24/7, and who doesn’t always answer the phone. Get a sense of the emergency rates the plumber will charge, so that you’re ready for it. If you can’t quickly figure out how to fix the problem, your best bet is to call a plumber. It can get pricey at first, but it’s better to get the expert to do it right. Also, if you’re friendly about it, they might show you what they’re doing so you’re better able to fix the same issue in the future.

Also, know how to contact your home insurance agent. It’s not a bad idea to check out the policy’s coverage of plumbing emergencies, just so you’re informed of your options when you call. If the cause of the issue is related to city water and sewage maintenance, the insurance agent might even help you negotiate with the municipal authorities.

Have a Mop and Shop Vacuum

A small but sturdy shop vacuum tends to cost less than the fancy vacuums you’ll find in most home goods stores, and almost all shop vacs are designed to clean up water. As soon as the crisis is over, try to vacuum up the excess water and mess. It also is good at removing water faster than towels or mopping. Once you’ve used the shop vac, clean with a good mop.