fixed the ptree generation