Fixed issues with looping behavior, incorrect port reporting.

Fixes for server crashing.