Fixed template inheritance problem