Kansas survives scare from Purdue