FIX: don't do void* pointer arithmetic
Improve error-handling in SSL connection code