Check your earths and the power connections around the engine bay, take off the inlet trunking and have a look at the throttle butterfly. If it's got nasty black sh*t all round it, clean that up and you may find it idles a bit better.
If these changes don't improve it, scrap it.