fixed dealing with (self signed) SSL certificates