Gap reports encouraging quarter as profit tops view