fix races while adding and removing of nodes