99 Jetta revving engine

Recently I got a lot of mud on my my 99 jetta with 100K miles which had been running without any problems. When covered in mud the engine kept revving and the car would shake but was not overheating. I cleaned out the air dam and underneath the car and now it runs smoothly unless the a/c is on or it is stopped for more than 30 seconds. Also when backing paraellel parking and the wheel is cut the car starts shaking again. I brought it to the mechanic and they dont know what it could be. Help?