Fix T3683: prevent the user from add an element with same name
Other small fixes
Signed-off-by: Alessandro Tundo <alessandrotundo94@gmail.com>