SSL fixes: rework