Turn around!
We get in certain areas when we are building software. We have that moment when we realize we are doing it wrong. It was our decision and everyone is watching. What do you do? The right thing is to acknowledge your new knowledge and then make a decision. Either realize that it will cost too much to turn back now, even though we know it would be better or turn around and take the hit and make it better now. I know there are a several other options in between, start a parallel track of work, start migrating in pieces to the better option, retrofit where possible, etc...
Remember sometimes it is OK to turn around.
A junior developer will almost always come into an existing code base and say, "there is a better way to do this, I should just right this over, it will be faster". What he doesn't realize that by the time he finishes, the next junior developer will say the same thing about his code. :-)
It takes a lot of humility to admit you made a bad decision, but it will make you realize more about your decisions and more about your organization, and the buzz it will create will probably help you identify your employees who trust you and those who are lacking confidence in the organization.
Being vulnerable builds trust
I don't mean pretending either. I mean being honest about something with your employees. Truly honest, hey, I think I screwed up and would love to hear any ideas on how to fix this. Hey, I'm having a rough day today for several reasons and wanted to let you know if I seem stressed or angry today. Some leadership skills say a strong leader never shows weakness, never shows they are upset, and are always the positive light of the company. I disagree with that, it makes me skeptical of them and I wonder what they are hiding. We all know we are human and make mistakes, don't push those mistakes down, bring them to the surface and get everyone on board with solving them together.
Don't operate out of fear
Easier said than done. Don't operate out of fear of losing your job, fear of losing your best employee, or the big one is fear of losing that biggest client. Losing that client for the sake of integrity and quality is worth it. Don't chase the money, chase the vision. What are you trying to build? A company that solves a problem, or a company that bends over backwards for any client that has some cash to throw your way. That is why VC money is a slippery slope for organizations, but I'll save that for another post.
Go build something amazing and be honest about yourself, people will want to know more.
(side note: the featured image is a real picture I took on my way to work today, only in NYC)