Fixed issue #1: max port range is 65535 instead of 65536