Better SSL error handling fixes issue #186