SSL security improvements and compat