Fix problems with serialization in cpp templates

Change-Id: I86f9f2c5943cb8501b2f5dffee3b7a09c26b3b37