fixes to templates for GCC