Fixed some problems with deleting node