Fixed error where client fails to connect

Fixed error that occurred when a client failed to connect to a server,
and then tried to connect again.