fixing cross thread invocation bug in client.cs