Fix port replacement