An attempt to fix #682 - core crash on client connect when using ssl.