fixed bug in getTotalValue function
was checking for equality with iterators from different lists!