Gap beats expectations in third quarter