fix some problems with client certificate handling