As Apple prepares to unveil the iPhone 6 on Sept. 9, engineers are toiling in secrecy to make sure everything works properly. Their task won’t end when the phone goes on sale. As customers line up to buy the device around the world, Apple employees will show up at work to learn how they screwed up—and fix it. Within hours of a new phone’s release, couriers start bringing defective returns from Apple’s retail stores to the company’s headquarters in Cupertino, Calif. In a testing room, the same engineers who built the iPhone try to figure out the problem, say former employees who have participated in the program and don’t want to anger their former employer. “They take them apart to diagnose what’s happening right then and there,” says Mark Wilhelm, who helped lead Apple’s returns program.