Fixed SSL bugs