Bugs were just the excuse - the cause was criminally hostile and deceitful post leadership.
Subpostmasters began reporting balancing errors within weeks of the Horizon system being installed, via the helpline the subpostmasters were instructed to use. The Post Office denied the subpostmasters' reports of faults in the system, insisted that the subpostmasters make up any shortfall of money, and in many cases untruthfully denied that any other subpostmasters had reported problems. In May 2002, shopkeeper Baljit Sethi raised concerns with the press that there were errors in Horizon, after his wife Anjana was notified that her subpostmaster contract would be terminated.[48] The Post Office responded that it "totally refuted" that the system was faulty, and that it had "sent experts ... to check it twice". - https://en.wikipedia.org/wiki/British_Post_Office_scandal