fix a port initialization bug on Linux.