Fixed a bug regarding removing of nodes