Template inheritance fixes