Various bug fixes moving to SSL

Signed-off-by: Luke Oatham <lukeoatham@gmail.com>