Fixed thread handling in client
'