Fix CPP template project crash