British Petroleum returns to profit in second quarter