fixes and improvements to ssl verification