US stocks end mostly higher