Fixed cpp code to reproduce the valid test templates again.