corrected bug when repeated elements in extensions

Signed-off-by: Emmanuel Mathot <emmanuel.mahot@gmail.com>