Fixed issues with looping behavior, incorrect port reporting.

Fixes for client crashing.