fixing memory corruption from ssl