added serialization for template