Fix port changing.

Drag in 4.0.x stuff too.