add exception handling for client thread