Fix strange behaviour when deleting several nodes in a row