Fix template inheritance