Improve port changing support.

This makes Debian 6 work, and hopefully Ubuntu 10.04 too.
Merge pull request #488 from apenney/fix-accept

Fix port changing.
Remove trailing whitespace.
Merge pull request #489 from apenney/you-gotta-be-kidding

Remove trailing whitespace.