improve serialization with SSL, and checked for successful deserialization