Fix port rebinding issue