Some fixes about elements removal on edit