Detecting defects in software