Fixing compilation issues discovered when templates were instantiatd