fixed bogus 'duplicated element in formula' error in some rare cases