There are can be cases where the formation of a company is simply a way to for the management to hide their actions. In this case, a court might argue that the corporate veil is not applicable because the company was just formed to serve the purpose of the directors and/or the shareholders.
For example, if I sell my business and I sell a patent (as a sole trader) and sign a document that says that I can develop anything in this field again, forming a company to bypass the “I can not develop” by creating a situation where I am not personally developing anything but I formed a company just to bypass this contract, then the veil might be lifted.