Exhibit (d)(17)(A) STOCK PURCHASE AGREEMENT dated as of July 12, 2002