Fixed sync client crashing when the host was gone.
Fixed some memory leaks/uninitialized variables.