fixing some of the bugs in deleteRemoteTrees