Homeowners may need to consider a litany of codes, ordinances, and requirements both when they remodel and when they put their homes up for sale. Understanding these rules and knowing when to seek expert assistance can help you and your clients avoid surprises during an inspection or at the closing table.

Late last year, Ian Katz was in a building-code bind. His buyers made an offer on what had been billed as a two-bedroom condo in New York City. Katz and the clients’ attorney realized during the due diligence period that the property was legally only a one-bedroom with bonus space. “The second bedroom shouldn’t have been classified as a bedroom because its window was too close to a neighboring building, yet the price reflected it being a room, so that needed to be re-evaluated,” he says. The buyers looked to Katz, a broker with Ian K. Katz Group in New York, to help them decide what to do. There were multiple offers on the table and inventory was—and still is—very tight in the category his clients were pursuing. But they didn’t want to feel as if they were overpaying for an improperly characterized space.

Katz ran a new comparable analysis for similar condominiums in the area, including apartments with similar square footage but with one bedroom plus a bonus space rather than two bedrooms. In the end he says, “we still found strong and compelling evidence to support that, even with the reduced bedroom count, the price was attractive and represented a fair deal.”

Perhaps equally important, Katz helped his buyers figure out whether the space fit their needs. “Though the room in question was not legally a bedroom, it had sufficient central heat and AC, and the closet space and the proportions my clients would need in order to use it as an office and temporary guest room,” he says. Thankfully, the appraisal supported their value assessment, and the deal closed last month.

But not all deals can recover from building code and permit issues. Here are some concrete actions you can take to better represent your clients in these sticky situations.

Ask to See the Permits

When listing agents highlight recent updates, it’s always smart to suggest your buyers ask to see the permit history. If the homeowners’ work crews never filed for the improvements, they may have to reapply or make changes, and that might disturb your buyers’ timetable and budget.

“You typically need permits to add on—or do a major renovation with mechanicals, plumbing, and electrical work—but not to change out a floor and trim,” says Anthony Della Porter, a builder whose eponymous firm is based in Vero Beach, Fla.

Because your role as the real estate professional is to be the source of the source, you should not attempt to verify the permits yourself. But by making sure your clients request them, you might be helping them avoid headaches.

But just because permits exist doesn’t mean everything’s settled. Tell your clients to check not only that permits were secured but also that each tradesperson signed off on the work so they are classified as “closed.” Such due diligence isn’t only about the paperwork, but also making sure updates are truly completed. In one transaction, real estate salesperson Kimberly Gibbs, whose firm Keller Williams Realty also is in Vero Beach, represented sellers who thought a new metal roof had been finished, but the roofer had forgotten some final steps, she says. “When we went to sell and found the permit still open, they had to bring in a roofer to finish the job, which added $1,300,” she says.

In his work, Katz has found that the due diligence of reviewing local department of building records has gone from “something on the periphery—and not always done—to an absolute necessity,” he says. “Developers and owners got careless in years past in not doing work to code or getting final sign-offs, and it fell on the current owner to correct the situation.”

Stay Up-to-Date on Local Rules

Be diligent; building, remodeling, and zoning standards are updated regularly, and they may differ by state, city, county, and town. Each of the 90 municipalities in St. Louis County, Mo., for example, has variations in their ordinances. “Inner-ring suburbs with historic homes have different rules than newer suburbs built in the last 20 years. Some areas don’t have local building codes at all,” says Celeste Rueter, executive vice president of the Home Builders Association of St. Louis & Eastern Missouri.

Connecticut-based architect and author Duo Dickinson advises real estate salespeople and homeowners to learn how to access their local and state codes online or make contact with someone in their area’s building department or at a local title company. Again, you can’t be the expert on such matters, but being aware of what’s happening in your area will mean you’re able to alert your clients to potential red flags that they may need to investigate.

Gibbs agrees with checking with officials in your municipality. “There’s no manual put out if changes are made. Usually, the best place to start is the building department in your town or county. They’re public servants and there for residents. Don’t be afraid to talk to them,” she says.

Not only do you have to stay current on changes, it’s important to realize that rules about home updates can vary block by block. Some historic districts have strict rules about changing exterior paint palettes, doors, windows, or entryways. In other areas, homeowners may be restricted in the height of new additions or the percentage of the lot that their home takes up.

Also, if you’re working with sellers who are making updates prior to putting their homes on the market, make sure they’re aware of the current permit rules. If not, work could be halted or need to be redone, which may add to expenses and drag out the transaction timeline, says Della Porter.

Help Clients Understand the Costs Involved

Zoning changes can also cause pricing problems and surprises at a hyperlocal level. In the suburb of Milburn, N.J., a steep-slope ordinance stipulating the height of homes built on property with more than a 10 percent grade was scaled back after it made it too difficult to sell empty residential lots, says Stephanie Mallios, a salesperson with Coldwell Banker Residential Brokerage in nearby Short Hills.

Sometimes bringing an existing building up to new, more stringent codes can be a deal-breaker. Gibbs watched buyers walk away from purchasing an older house because the extent of the improvements they wanted to make would have required bringing all plumbing and electrical work up to current codes. “It would have been too costly. They could have left the old systems intact, but didn’t want to,” she says.

Understand New-Construction Requirements

Help buyers determine whether their builder is complying with the International Building Code (for multifamily buildings) or International Residential Code (for one- and two-family dwellings and townhomes up to three stories), both developed by the International Code Council based in Washington, D.C. Rules are revised every three years; the last set came out in 2015. States have the discretion to accept the code in its entirety, adapt rules for their state, or allow municipalities to make changes. California lets cities modify standards according to local conditions, in particular regarding energy consumption, says architect Chris S. Texter, with the Irvine, Calif.–based architecture and planning firm KTGY. Florida has a state code, which tends to be enforced in a consistent way throughout the state. In recent years, the sunshine state has enacted stricter guidelines for materials, systems, and methods so houses better withstand hurricane winds and rains.

Some states—such as Arizona and Missouri—don’t adopt a code and leave the decision to their cities or counties. For example, Gilbert, Ariz., is currently on the 2012 IRC code while neighboring Chandler is on the 2015 code, says Texter. Dorothy Harris, vice president of government relations for the International Code Council recommends checking out their website for more specific information.

With such leeway, confusion and disagreements ensue. Recently, the St. Louis County Building Commission approved the 2015 IRC with amendments recommended by the county’s Building Code Review Committee. The area’s Home Builders Association supported the amendments while environmentalist groups were opposed because they thought the new rules would lower energy efficiency standards and cost homeowners more money, according to John Hickey with the Missouri chapter of the Sierra Club.

Rueter, of the Home Builders Association of St. Louis & Eastern Missouri, disagrees. “The national code model is meant to be amended to fit local needs and climate. Adopting the model code without amendments would impose an up-front cost on home buyers that would take 50-plus years to recoup through savings on energy bills.” A County Council will make a final determination, but for now the situation is still up in the air.