Adding SSL error handling