fixed bug in setValues() that caused a fatal error when setting the value of a element that appeared multiple times