Fixed SecureConnection crashing and the associated memory leak