[PATCH] Fix port number handling