Fix problem with deletion of nodes