fix error handling on SSL handles
Merge remote-tracking branch 'tr/master'