Some fixes when pyopenssl is used instead of python ssl module.