Your business partner walks into the office. He doesn't look good. “Have you got a minute?” he asks. The rest of the morning -- as well as the day -- is shot. He fills you in on how the company has broken the law. In the world of entrepreneurship this happens all too frequently.

A few of your employees have been misclassified as being not subject to overtime. You considered them to be salaried employees and arranged that they get a fixed amount despite the number of hours they worked. In fact, you should have bumped up their pay for every hour that they worked over the usual 40 hours. You could have a large liability.

Related: Three Common Small-Business Tax Mistakes

Another problem occurred: You underpaid your taxes. The person who handles company finances has now realized you have been deducting certain expenses annually. He tells you that legally you are required to capitalize the expense and only write a portion each year.

Also without anyone noticing, a new law was passed and slipped everyone's notice: The account executives were supposed to receive training, apply for a license and pay a regulatory fee. The date for doing so passed months ago and now costly infractions are due. The sales they made are in limbo. Technically, your customers and clients could walk away from every contract that was inked since the ruling went into effect.

When looking at bad news, newly minted CEOs usually feel they have just two modes of operation: denial or panic. The initial piece of guidance is simple: Don’t panic and don’t deny. The correct course is usually in the middle.

If disregarded, the trouble may increase. Therefore take the following steps:

1. Gather complete details. Thoroughly scrutinize the situation. Starting off with inaccurate, or partial, information can be just as bad as not investigating at all. Minimize the number of people in the company who are aware of the situation.

2. Find a good attorney. Just because you look for a lawyer doesn’t mean you will need one. It is still best to talk to one as soon as possible so you can get qualified legal advice from the start.

Related: Hiring a Lawyer: 5 Mistakes to Avoid

3. Deal with the errant employee. In some cases, a single employee may have caused the problem. Maybe he or she has been embezzling or carelessly caused a terrible accident. You will need to decide whether to keep him or her on the payroll and consider what actions law enforcement may take. There aren’t any easy answers and there are a lot of things to consider.

Sometimes, employees violate the law while still meaning the best. Sometimes they just aren’t cognizant of new laws. Often amid the drive to produce, an employee has take shortcuts and overlook getting the necessary approvals.

4. Overcome the setback and move forward. Often violations crop up as a result of a tug-of-war within industries. Ophthalmologists have been fighting over the question of opticians prescribing medicine and performing certain procedures. Here, “crimes” are really just turf battles and fighting the charges in some forum might be good for business.

5. Take an ounce of prevention. It’s common sense to just avoid violating any laws. This is a lesson you don’t want to learn the hard way. Getting your company past the humiliation of a criminal case can take years. Set up a program of legal compliance early on that make sure your company is on alert  for new laws. 

Everybody makes mistakes. Smart entrepreneurs avoid them when they can and quickly take steps to fix them when they can’t be avoided.

Related: Writing Social Media Guidelines for Your Company? Tread Carefully.