This is a concept I’ve been preaching recently. It’s very simple.
A bug indicates a failure to understand something. It might be a failure to understand what some code does, or it might be a failure to understand what the code should do.
If you simply try to make the bug go away, that failure to understand something will likely remain, and it will likely lead to new bugs.
What you must instead do is figure out what that failure of understanding was and rectify it. This will not only fix the bug, it will also prevent future bugs that would have emerged from that failure.