Fixed a bug occuring when deleting selected nodes