added auto-detection of serialization format for deserialization