Improved SSL support, thanks to @konklone