Fix template registration issues