ExxonMobil and Chevron reverse losses amid higher oil prices