Fix raw template initialization and cleaning. Fix compilation Warnings.