How to minimize and prevent bugs