fix port number handling