“Bug fixing often uncovers opportunities for refactoring. The very fact that you’re working with code that contains a bug indicates that there is a chance that it could be clearer or better structured.”
Software Testing Articles, Blog Posts, Books, Podcasts and Quotes
Program testing can be used to show the presence of bugs, but never to show their absence! Edsger W. Dijkstra Source: Notes On Structured Programming, 1970, at the end of section 3, On The Reliability of Mechanisms.