The check engine light more than likely has to do with a vacuum line that is not plugged or not there when it needs to be, when you bring your rev's up it goes off idle and therefor can cancel the erratic idle.
Do you have the ECV sticker under your hood on the cowl still ? It will have the diagram if you can read it, other wise there are a couple of members who have access to those kind of things, you will have to wait until they see your post though.