I wonder how long the replacement engine had been standing?
When I changed the Vanos on mine, I used a replacement that had been refurbished and left on a shelf for a while. It turned out the solenoid valves were sticking in the bores as they had no oil around them for a while. I whipped off the solenoids, popped the valves out, gave them a very light rub down, plenty of oil and back together. Solved the hunting I had.
Might be worth a check. Inlet is easy as it's at the top. Exhaust one is a bit harder to see what you're doing. Once the solenoids are off, you should be able to easily push the valves in and they should pop back up again. Anything other than free and easy movement could be your issue.
When I changed the Vanos on mine, I used a replacement that had been refurbished and left on a shelf for a while. It turned out the solenoid valves were sticking in the bores as they had no oil around them for a while. I whipped off the solenoids, popped the valves out, gave them a very light rub down, plenty of oil and back together. Solved the hunting I had.
Might be worth a check. Inlet is easy as it's at the top. Exhaust one is a bit harder to see what you're doing. Once the solenoids are off, you should be able to easily push the valves in and they should pop back up again. Anything other than free and easy movement could be your issue.

