add serialization hooks for classes