if the replacement is not for the root node

if(p != *ptree)