fixing remove function for tree