A couple of weeks ago it rained really hard and flooded the streets. Before I could get off the flooded roadway, my cold air intake managed to suck up a bunch of water into the engine (that killed it instantly

). Well, because of that I tore the engine down and gave it a full re-ring. Naturally I changed all the gaskets and installed new timing belts... everything was done by-the-book.
Now I have the car all back together and it starts right up, but has a couple of problems. Firstly it idles too low and will most often just die. Secondly it has a horrible "lag" from idle to about 2500 -above 2500 it does well.
I've replaced the O2 sensor since it was likely that it was fouled when the water entered the engine and also rechecked my cam timing. If I advance the timing using the distributor it runs better and gets rid of the lag, but I have to advance it beyond what the notches in the distributor allow. I've also insured that I have no vacuum leaks.
Anyone got any ideas on what might be the culprit here?
Thanks for any input.
1994 Prelude, H23A1 A/T