First off, pull out the main engine fuses for 30 seconds plus as this will get the ECU to lose all codes. Then drive it and see what codes flash up then.
It could be a faulty oxygen sensor.
Too late now but worthwhile getting an idependent mechanical check before you buy the car ?