bad ssl logic fix