added nil check for ssl cert