Make ptree a template, but has bug