added generic [de]serialization methods