Fix issue deleting metadata elements introduced in 99879dee837